To reproduce, use the example JSON, but change one of the "consumes" keys like so:
"consumes" =>["application/json","application/xml","\"><script>alert(1)</script>"]
Or:
"produces" =>["application/xml","application/json","\"><script>alert(1)</script>"]
You will see the alert dialog execute.