Encoding

Simulate JSONP requests and parse responses

Generated Script Tag
<script src="https://api.example.com/data?callback=myCallback"></script>
Parsed Result
{
  "name": "John",
  "age": 30
}

How JSONP Works

JSONP (JSON with Padding) is a technique used to bypass cross-origin policy limitations in browsers. It works by:

  1. Creating a script tag with a URL that includes a callback parameter
  2. The server wraps the JSON response in the callback function
  3. The browser executes the script, calling the callback with the data