JSON URL Encode
Percent-encode JSON so it's safe to put in a URL, query parameter or form value.
Example
Input
{"q":"a b & c","ok":true}Output
%7B%22q%22%3A%22a%20b%20%26%20c%22%2C%22ok%22%3Atrue%7D
How it works
The encoder applies standard percent-encoding (the same as encodeURIComponent) so characters like spaces, quotes and ampersands become URL-safe sequences such as %20 and %22.
Good to know
JSON URL Encode takes a block of JSON (or any text) and converts every character that has special meaning in a URL into its percent-encoded equivalent — spaces become %20, double quotes become %22, curly braces become %7B and %7D, and reserved characters like &, =, ? and # are escaped so they no longer break the surrounding URL. It's aimed at developers, API integrators and anyone who needs to stuff a JSON payload into a query string, a deep link, a webhook URL or a hidden form field without it being mangled in transit.
Reach for it whenever JSON has to travel inside a URL rather than in a request body — for example passing a filter object as ?q=..., building a shareable link that carries state, pre-filling a redirect, or quickly testing an endpoint by hand. The output is one continuous percent-encoded string with no line breaks, so you can paste it directly after the = in a parameter. To get the original JSON back, run the encoded string through a matching URL-decoder; encoding and decoding are exact inverses, so nothing is lost.
A few practical points worth keeping in mind when reading the result:
- The tool encodes the whole input as a single value (like
encodeURIComponent), so it's meant for one parameter value — not for building an entire URL with multiple key=value pairs at once. - It does not check whether your input is valid JSON, which is convenient for templated or partial snippets but means typos pass through untouched.
- Long JSON can produce a very long encoded string; browsers and servers cap URL length (often around 2,000–8,000 characters), so for large payloads a POST body is usually the better choice.
Frequently asked questions
When do I need to URL-encode JSON?
Whenever JSON travels in a URL or query string — encoding prevents characters like & and = from breaking the URL.
Is the JSON validated first?
No — encoding works on any text, so you can encode partial or templated JSON too.
Is my JSON uploaded anywhere?
No — everything runs in your browser with JavaScript. Your data never leaves your device, so it's safe for sensitive payloads and works offline once loaded.
Is this tool free?
Yes, completely free with no sign-up and no limits.
More JSON tools
People also ask
What is the difference between URL encoding and Base64 encoding JSON?
URL encoding (percent-encoding) replaces only the characters that are unsafe in a URL, keeping the rest readable, and is reversible with a URL decoder. Base64 transforms the entire payload into an alphabet of letters, digits and a few symbols, producing a more compact, opaque string that is not human-readable. Use percent-encoding for query parameters and Base64 when you want to obscure or transport binary-safe blobs.
Does encodeURIComponent encode every character?
No. It leaves unreserved characters untouched — letters A–Z and a–z, digits 0–9, and the symbols hyphen, underscore, period, exclamation mark, tilde, asterisk, single quote, and parentheses. Everything else, including spaces, quotes, braces and reserved URL characters, gets percent-encoded.
Why does my JSON break when I put it in a URL without encoding?
JSON commonly contains characters that are structural in a URL, such as ampersands, equals signs, question marks and hash marks. An unencoded ampersand, for instance, starts a new query parameter, so the server reads only part of your JSON. Percent-encoding neutralizes these characters so the value is passed intact.
How do I decode URL-encoded JSON back to its original form?
Pass the encoded string through a URL-decoder (the equivalent of JavaScript's decodeURIComponent), which converts sequences like %20 and %22 back into spaces and quotes. The result is the exact original JSON text, which you can then parse normally.
Should I encode JSON before or after building the query string?
Encode each JSON value first, then place the already-encoded value after the parameter name and equals sign. Encoding the whole URL at once would also escape the slashes, colon and question mark you need to keep literal, breaking the URL structure.
Is it safe to put sensitive JSON in a URL after encoding it?
Encoding makes JSON URL-safe but does not encrypt or hide it — the values remain readable to anyone who decodes the string. URLs are also frequently logged by servers, proxies and browser history, so sensitive data is generally better sent in a request body over HTTPS rather than in a query string.
Why is my encoded JSON longer than the original?
Each escaped character is replaced by a percent sign followed by two hexadecimal digits, so a single space or quote becomes three characters. JSON that is dense with quotes, braces and spaces can grow noticeably, which is normal and fully reversible on decode.
Can I URL-encode invalid or partial JSON?
Yes. Percent-encoding operates on raw text and does not validate structure, so partial snippets, templated placeholders or malformed JSON all encode without error. Just remember that any mistakes in the input will still be present after decoding.