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
- The input is parsed. If it is not valid JSON, you get the parser’s error message instead of a silently broken URL.
- The original text is percent-encoded exactly as typed — whitespace included — using UTF-8.
- Reserved and unsafe characters are encoded:
{ }become%7B %7D, quotes%22, colons%3Aand commas%2C. Only!'()*are left as they are, asencodeURIComponentdoes.
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%7DThe 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%7Bbecomes%257Band 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. UseencodeURIComponentfor 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=adminis 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.