Xerobit

JSON to Query String Converter

Paste a JSON object to convert it into a URL query string using this json to query string tool. Nested objects use bracket notation, arrays repeat keys, and all values are properly percent-encoded. The conversion runs entirely in your browser so nothing is uploaded to any server.

A valid JSON object. Arrays, nested objects, null and unicode are supported.

Prepend ? to the output, ready to append directly to a URL path.

Query String

name=Ada

By · Published · How we build and test tools

How to use the json to query string converter

  1. Paste or type a valid JSON object into the JSON input field.
  2. Check Include leading question mark if you need the result ready to append to a URL path.
  3. The json to query string conversion updates automatically as you type.
  4. Copy the result from the output area.

How the json to query string conversion works

The converter parses the JSON text with JSON.parse, then walks the resulting object recursively. Primitive values (strings, numbers, booleans) become key=value pairs joined by ampersands. Keys and values are percent-encoded using encodeURIComponent.

Nested objects use bracket notation. For example, {"user":{"id":42}} becomes user%5Bid%5D=42, which decodes to user[id]=42. This matches the convention used by PHP, Rails and most query string parsers.

Arrays repeat the key for each element: {"tag":["a","b"]} produces tag=a&tag=b. Arrays that contain objects or other arrays use indexed brackets instead, such as items[0][id]=1, so the pairs stay unambiguous. Null values produce an empty value (key=), while booleans become the literal strings true or false.

Encoding rules reference

Every key and value passes through encodeURIComponent, with the apostrophe, parentheses, asterisk and exclamation mark also encoded, so only the unreserved characters of RFC 3986 stay as they are: letters, digits, hyphens, underscores, periods and tildes. Spaces become %20, not plus signs.

Input characterEncoded formNotes
space%20Plus encoding (+) is not used here
&%26Would otherwise split parameters
=%3DWould otherwise separate key from value
[%5BUsed in bracket notation for nesting
]%5DCloses bracket notation
#%23Would otherwise start a fragment
%%25Escape character itself

Common mistakes and edge cases

A frequent error is passing a JSON array at the top level instead of an object. A query string requires named parameters, so the root value must be a JSON object. Passing [1,2,3] will return a parse error.

Another issue is trailing commas or single quotes, which are invalid JSON. The parser follows the strict JSON specification: keys must be double-quoted strings, and no trailing commas are allowed. If your data comes from JavaScript source code rather than an API response, you may need to clean it first or use a tool like JSON fixer.

Very deep nesting (more than ten levels) can produce extremely long keys that some servers reject. Most web frameworks handle two or three levels of brackets without trouble, but beyond that you should consider sending the data as a JSON body instead of query parameters.

When to use query strings versus other formats

Query strings are ideal for GET requests where parameters appear in the URL: search filters, pagination offsets, sort orders and feature flags. They are bookmarkable and cache-friendly.

For complex payloads, other serializations work better. If you need to send structured data to a database layer, converting JSON to SQL statements is more appropriate. For rendering tabular data on a page, JSON to HTML table or JSON to markdown table converters save time. When exchanging data between services that expect XML, use a JSON to XML tool instead.

The key rule is that query strings have practical length limits. Browsers and servers typically cap URLs around 2,000 to 8,000 characters. If your JSON object produces a string longer than that, switch to a POST request with a JSON body.

Bracket notation compatibility

The bracket notation used for nested objects (user[id]=42) is understood natively by PHP's $_GET superglobal, Ruby on Rails parameter parsing, Express.js with the qs library and Python's Django framework. However, some older or minimal parsers only read flat keys and ignore brackets entirely.

If your target server does not support bracket notation, flatten the JSON first so every key is a simple string. You can also manually rename nested keys before conversion, using dot notation (user.id) if the receiving application expects that style instead.

Worked examples

ExampleInputResult
Simple objectJSON input: {"name":"Ada Lovelace","year":1815}; Include leading question mark: noname=Ada%20Lovelace&year=1815
Nested object and arrayJSON input: {"user":{"id":42,"role":"admin"},"tags":["math","code"]}; Include leading question mark: yes?tags=math&tags=code&user%5Bid%5D=42&user%5Brole%5D=admin
Unicode and spacesJSON input: {"city":"Zürich","greeting":"hello world"}; Include leading question mark: nocity=Z%C3%BCrich&greeting=hello%20world

FAQ

Does this tool upload my JSON to a server?

No. The json to query string conversion runs entirely in your browser using JavaScript. Nothing leaves your device.

How are arrays handled?

Each array element produces a separate key-value pair with the same key name. For example, [1, 2] under the key "id" becomes id=1&id=2.

What happens to null values?

Null values are converted to empty strings. The key appears in the output with no value after the equals sign, such as key=.

Are spaces encoded as plus signs or %20?

Spaces are encoded as %20. This follows the encodeURIComponent standard and avoids ambiguity with literal plus signs in values.

Can I pass a JSON array as the root value?

No. A query string requires named parameters, so the root must be a JSON object. Passing an array will return an error.

Why do my brackets appear as %5B and %5D?

Square brackets are percent-encoded because they are reserved characters in URLs. Servers decode them back to brackets when parsing the query string.