1001Ferramentas
🔄Converters

JSONP to JSON Converter

Strips the callback wrapper of a JSONP response leaving only the JSON contained inside the parentheses.

Stripping the callback wrapper off JSONP

You opened an old API endpoint in the browser and got back something like callback({...});. That is JSONP: JSON wrapped in a function call, the trick everyone used to dodge the same-origin policy before CORS existed. No JSON parser will touch it, so pasting it into a validator fails on the very first character. Paste the whole response here and you get just the payload back.

The tool matches the entire input against the pattern name(content), with an optional trailing semicolon, and returns whatever sits between the first and the last parenthesis, trimmed. Callback names may contain letters, digits, underscores, dollar signs and dots, so a response shaped like angular.callbacks._0({...}) works fine. When nothing matches you get a not-recognised message rather than a wrong answer.

Two practical notes. Google APIs tend to prefix the body with a /**/ comment, and that prefix breaks the match, so delete it before pasting. The payload comes out as raw text with no validation and no reindenting, so if the call carries more than one argument you get all of them, comma separated. The page is just the two boxes, and everything runs in your browser.

Frequently asked questions

Does it pretty-print the result?
No. You get exactly the text that sat inside the parentheses, minus the surrounding whitespace. Run it through a JSON formatter afterwards if you need it indented.
Does it handle the /**/ prefix used by Google APIs?
No. The pattern expects the input to begin with the function name, so strip the leading comment before pasting.
Does it check that the payload is valid JSON?
No. It only removes the wrapper. If the server returned JavaScript with single quotes or unquoted keys, that comes through untouched.

Related Tools