What JSON URL Encode does
Validate JSON, minify it, then percent-encode it for a URL query parameter.
JSON URL Encode examples
The built-in sample
Input
{"name":"Ada Lovelace","active":true,"tags":["math","code"],"address":{"city":"London"}}Output
%7B%22name%22%3A%22Ada%20Lovelace%22%2C%22active%22%3Atrue%2C%22tags%22%3A%5B%22math%22%2C%22code%22%5D%2C%22address%22%3A%7B%22city%22%3A%22London%22%7D%7DThis is the input that the Load sample button fills in.
Whitespace is removed before encoding
Input
{ "q": "a b", "n": [1, 2] }Output
%7B%22q%22%3A%22a%20b%22%2C%22n%22%3A%5B1%2C2%5D%7DThe JSON is minified first, so the spaces after the colons and commas are not encoded. The space inside the string value is data and becomes %20.
Each output was produced by running this tool on the input above it.
How it works
The input is first checked as JSON; invalid input is reported instead of being encoded. It is then minified, so the encoded value is as short as possible. The text is percent-encoded with the same rules as URL Encode: everything except letters, digits and - _ . ! ~ * ' ( ) becomes %XX.
Details and limits
- Because the JSON is parsed first, duplicate keys collapse and number spellings are normalised before encoding, as in JSON Minify.
- Browsers and servers limit the length of a URL, commonly to a few thousand characters. Percent-encoding roughly triples the size of quotes, braces and colons, so large documents belong in a request body.
- Input that is not valid JSON stops the tool, and the status line shows where the problem is. The JSON Validator page lists the usual causes.
Questions
Is my data uploaded when I use JSON URL Encode?
No. The tool runs in your browser, so what you paste or open is processed on your own device and is not sent to a server.
What does JSON URL Encode do?
Validate JSON, minify it, then percent-encode it for a URL query parameter.
How does JSON URL Encode work?
The input is first checked as JSON; invalid input is reported instead of being encoded. It is then minified, so the encoded value is as short as possible.
Are there any limits I should know about?
Because the JSON is parsed first, duplicate keys collapse and number spellings are normalised before encoding, as in JSON Minify. Browsers and servers limit the length of a URL, commonly to a few thousand characters. Percent-encoding roughly triples the size of quotes, braces and colons, so large documents belong in a request body.
Is there a size limit?
There is no fixed size limit. Everything happens on your device, so very large inputs depend on its memory and can take longer on a phone than on a computer.
Does it work on phones, and is it free?
Yes. It works in any current browser on Android phones, iPhones, tablets and computers. It is free and needs no account or sign-up.