{"version":"1.0","type":"rich","title":"A Flask decorator that takes a response with JSON content and converts it to a well-formatted JSONP response.","description":"This example shows a Flask decorator that transforms a standard JSON response into a JSONP response by wrapping the payload in a callback function. The decorator checks for a `callback` parameter in the request arguments and aborts with a 404 if it is missing. It then calls the wrapped view function, converts the result to a response object if it is a plain string, and replaces the response data with `callback(payload)` while setting the MIME type to `application/javascript`. The code uses Flask’s `request.args`, `make_response`, and `abort` APIs, along with `functools.wraps` to preserve function metadata.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-6594226?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}