FormatterHQ

JSON URL Encode

Validate JSON and percent-encode it in one step, ready to be passed as a URL query parameter, a redirect state value or a deep-link payload.

Loading tool…
Ready.

How to use the JSON URL Encode

  1. Type or paste into the JSON box, or click Sample. You can also drop a text file on either box, or load one into the URL encoded box with its Open file button.
  2. The URL encoded box updates live as you type. It works both ways — edit the URL encoded side to convert back, or click ⇄ Swap to exchange the sides.
  3. Use Copy or Download on either box to take the result, or Clear to start again.

JSON URL encode for query parameters

This JSON URL encode tool prepares a JSON value for use as a single query parameter in one step.

Passing a JSON object in a URL is common — filter definitions in dashboards, state values in OAuth flows, GraphQL variables in GET requests, deep-link payloads in mobile apps. Braces, quotes, & and = would all break a query string, so the JSON must be URL encoded first. This tool checks that your input is valid JSON and then encodes it with encodeURIComponent rules.

What happens to your JSON

  1. The input is parsed. If it is not valid JSON, you get the parser’s error message instead of a silently broken URL.
  2. The original text is percent-encoded exactly as typed — whitespace included — using UTF-8.
  3. Reserved and unsafe characters are encoded: { } become %7B %7D, quotes %22, colons %3A and commas %2C. Only !'()* are left as they are, as encodeURIComponent does.

Example

Input:

{"user":"ada","roles":["admin","dev"],"note":"a&b=c"}

Output:

%7B%22user%22%3A%22ada%22%2C%22roles%22%3A%5B%22admin%22%2C%22dev%22%5D%2C%22note%22%3A%22a%26b%3Dc%22%7D

The result can be appended as ?filter= followed by the output. The & and = inside the note value are safely encoded, so the server sees one parameter rather than three.

Keep the URL short

Whitespace is encoded too, and %20 or %0A take three characters each. Minify the JSON first with JSON Minify to shorten the URL. Browsers and servers commonly cap URLs somewhere between about 2,000 and 8,000 characters, so large payloads belong in a POST body instead.

Common mistakes

  • Encoding twice. Encoding an already encoded value turns every % into %25, so %7B becomes %257B and the server receives percent signs instead of JSON. Encode once, just before building the URL.
  • Using encodeURI. It leaves &, =, ?, # and , untouched because they are legal in a full URL, which lets them split your parameter. Use encodeURIComponent for a single value, as this tool does.
  • Unencoded plus signs. Form-style decoders read + as a space, so a hand-built URL containing "+1 555" arrives with a space. Encoded properly, the plus becomes %2B.

Alternatives

  • Base64URL. Encoding the JSON with the URL-safe Base64 alphabet (see JSON to Base64) produces a shorter, opaque token, which is how JWTs carry their payload.
  • Separate parameters. For flat objects, ?user=ada&role=admin is easier to read, cache and log than one encoded JSON blob.

Reading the parameter back

On the receiving side, the web framework normally percent-decodes query parameters automatically, so you only need to parse the JSON: JSON.parse(new URLSearchParams(location.search).get("filter")) in the browser, or json.loads(request.args["filter"]) in a Flask app. Always validate the parsed object before using it — a URL is user input, and anyone can edit it to send different filters, IDs or flags than your interface would.

Decode the value on the other side with JSON URL Decode. Everything happens in your browser.

Frequently asked questions

Can I put JSON directly in a URL?
Only after percent-encoding it. Raw JSON contains characters such as {, ", & and = that have special meaning in URLs or are not allowed at all.
Does the tool minify the JSON?
No. It encodes exactly what you typed, including spaces and line breaks. Minify the JSON first if you want the shortest possible URL.
How do I read the JSON on the server?
Most frameworks decode query parameters automatically, so you only need to parse the value: JSON.parse in JavaScript, json.loads in Python or json_decode in PHP.
Is JSON in a URL secure?
URLs end up in browser history, server logs and referrer headers, so never put passwords, tokens or personal data in them, encoded or not.

Last updated October 3, 2026

Related tools

URL Encode Percent-encode text or URLs online so they can be used safely in query strings, paths and form data. XML URL Encode URL-encode XML so it can be sent as a query-string parameter or form field without breaking the URL. YAML URL Encode URL-encode YAML so it can be sent as a query-string parameter or form field without breaking the URL. JSON URL Decode Decode a URL-encoded JSON string back into readable JSON and pretty-print it. URL Decode Decode percent-encoded URLs and query strings back into readable text, with full UTF-8 support. URL Parser Break a URL into scheme, host, port, path, query parameters and fragment. Decodes values and parses many URLs at once. JWK to PEM Converter Convert JSON Web Keys or a whole JWKS (RSA, EC, OKP) into PEM public (SPKI) and private (PKCS#8) keys. Morse Code Translator Translate text to Morse code and Morse code back to text in two linked boxes, one for each direction. PEM to DER Converter Convert PEM certificates, keys and CSRs to binary DER: view it as hex or Base64 or download the .der file. PEM to JWK Converter Convert PEM public keys, private keys and certificates (RSA, EC, Ed25519) to JSON Web Keys or a JWKS with a thumbprint kid. ROT13 Encoder / Decoder Encode or decode ROT13 text instantly. ROT13 shifts each letter 13 places, so the same operation hides and reveals spoilers. SAML Response Decoder Decode Base64 or deflated SAMLResponse and SAMLRequest messages into readable XML and summarise issuer, NameID, conditions and attributes.