JSON URL Encode Online
Encode a JSON object or array into a percent-encoded URL-safe string. Paste your JSON, click Encode, and paste the result directly into a query string: no escaping headaches, no broken URLs, no manual character replacement.
Why pasting raw JSON into a URL always breaks it
JSON uses characters that carry special meaning in URLs: { } delimit objects, " wraps strings, : separates keys and values, & splits query parameters, = assigns values. When you paste { "role":"admin" } into a browser address bar or API call, the parser interprets = as parameter assignment and & as the start of a new parameter: fragmenting your JSON into noise.
Percent-encoding converts every unsafe character into a % followed by its two-digit hex code. { becomes %7B, } becomes %7D, " becomes %22. The resulting string is opaque to URL parsers: they see one parameter value and decode it correctly when passing it to your application.
Concrete example
JSON: cannot be placed in a URL as-is
{"status":"active","roles":["admin","editor"],"limit":25}Percent-encoded: safe in any query parameter
%7B%22status%22%3A%22active%22%2C%22roles%22%3A%5B%22admin%22%2C%22editor%22%5D%2C%22limit%22%3A25%7D
Full URL
/api/users?filter=%7B%22status%22%3A%22active%22...%7D
How to use
- Paste your JSON object or array into the input. The tool validates JSON before encoding: if your JSON is malformed you will see a specific error.
- Click Encode →.
- Copy the percent-encoded output.
- Use it in your query string:
?filter=encoded-value - To reverse the process: decode an encoded string back to JSON: use the JSON URL Decode tool.
Real-world developer scenarios
URL length limit: when to use a POST body instead
Percent-encoding expands each non-ASCII character to 3 bytes (%XX). A 300-byte JSON object may become 900+ characters after encoding, and most browsers and proxies handle URLs up to 2,048 characters safely. If your JSON is larger than about 400 bytes, consider switching to a POST request with the JSON in the request body (Content-Type: application/json): it is more reliable, has no size limit, and keeps sensitive data out of server logs and browser history.
Privacy
Encoding runs entirely in your browser using the native encodeURIComponent function. Your JSON is never sent to any server: not ours, not anyone else's. Check the Network tab in DevTools while encoding: no requests will appear. This matters especially if your JSON contains authentication tokens, user identifiers, or other sensitive values.
Frequently asked questions
Why does my JSON break the URL when I paste it directly?
JSON contains characters that are reserved in URL syntax: { } " : [ ] & = and space: which the browser and server interpret as URL structure, not data. Percent-encoding replaces every reserved character with its %XX hex escape, so the JSON survives URL parsing as a single opaque parameter value.
Should I use encodeURIComponent or encodeURI for JSON?
Always encodeURIComponent for JSON in a query parameter. encodeURI leaves characters like : and = unencoded because it is designed for full URLs. encodeURIComponent encodes everything except letters, digits, and -_.!~*'(): which is exactly what you need for a safe query value. This tool uses encodeURIComponent.
What is the URL length limit for encoded JSON?
Most browsers and servers safely handle URLs up to 2,048 characters. Percent-encoding expands each unsafe character to 3 characters. A 300-byte JSON object can expand to ~900 encoded characters. For JSON larger than ~400 bytes, use a POST request body instead.
Can I encode a JSON array (not just an object) in a URL?
Yes. Any valid JSON value: array, object, string, number: can be encoded. For example, ?ids=%5B1%2C2%2C3%5D decodes to [1,2,3]. Check that your server framework handles it correctly: Express and Django both have their own conventions for array parameters.
Does this encode the entire JSON or just the values?
The entire JSON string is encoded as a unit: keys, values, and all structural characters. This produces one single encoded string that your server can decode back to the original JSON with decodeURIComponent (or your framework's automatic decoding).
My JSON has a base64 image string: will that survive encoding?
Yes, but base64 strings contain + and = characters which are encoded to %2B and %3D. More importantly, a base64 image can be tens of kilobytes: far too large for a URL parameter. Store images separately and reference them by ID or URL instead.
Does percent-encoding hide or protect my JSON from being read?
No. Percent-encoding is not encryption: anyone can decode it instantly with decodeURIComponent. URLs appear in server access logs, browser history, Referer headers, and network monitoring tools. Do not put secrets, passwords, or private keys in URL parameters, encoded or otherwise.
The server is receiving my encoded JSON but it looks double-encoded: why?
Your framework is probably URL-decoding the query string automatically before your code receives it. If you then call decodeURIComponent again in your application, the first decoding step already happened. Check whether your framework's request.query or params object already gives you the decoded value. Most modern frameworks (Express, FastAPI, Rails) decode query parameters automatically.
Related tools