JSON to Query String
Turn a JSON object into a URL query string — nested objects and arrays use bracket notation (user[address][city]=…), values are percent-encoded.
Object in, query string out
A query string is the flat key=value&key=value part after the ? in a URL. This tool serializes a JSON object into one, percent-encoding every value so spaces, ampersands and unicode survive. Nested structure is preserved with bracket notation — the convention used by the qs library, Rails and PHP:
{ "q": "json tools", "page": 2, "filter": { "type": "free" }, "tags": ["a","b"] }
q=json%20tools&page=2&filter[type]=free&tags[0]=a&tags[1]=bWhere it's handy
- Building a request URL by hand from a config object.
- Reproducing an API call in the browser address bar or a curl command.
- Turning form state or filters into a shareable, bookmarkable link.
A note on encoding
Values are encoded with encodeURIComponent, so they are safe to drop straight into a URL. Booleans and numbers become their text form (true, 2) — query strings have no types. To go back, Query String to JSON reverses this, rebuilding nesting from the brackets.
Frequently asked questions
How is nested JSON represented?
With bracket notation: {"a":{"b":1}} becomes a[b]=1, and arrays use numeric indices, tags[0]=x. This matches the qs library, Rails and PHP, so most backends parse it back into the same structure.
Are values URL-encoded?
Yes — every value is passed through encodeURIComponent, so spaces become %20, ampersands %26, and unicode is encoded. The result can be pasted directly after a ? in a URL.
What happens to numbers, booleans and null?
They become their text form: 2, true, and an empty value for null (key=). Query strings carry no type information, so everything is ultimately a string on arrival.
Why must the top level be an object?
Query strings are key/value pairs, which map to object properties. A bare array or value has no keys to serialize — wrap it in an object first.