Skip to main content

Encoding & Escaping / Encoding & Escaping

Query String to JSON

Query String to JSON converts the part of a URL after the question mark into a structured JSON object and back again. It keeps repeated keys as arrays, expands bracket notation into nested objects, and decodes percent-encoding so you can see exactly what the parameters mean. Nothing is uploaded.

Sponsored

This space is reserved for a sponsor.

Sponsored

This space is reserved for a sponsor.

How to use

  1. 1

    Paste a query string

    Drop in the parameters from a URL — with or without the leading question mark. The converter parses them immediately and shows the resulting JSON, so you can read a long, messy parameter list as a clean nested structure instead of one run-on string.

  2. 2

    Convert and inspect the JSON

    Repeated keys such as a=1&a=2 become an array ["1","2"], because a JSON object cannot hold the same key twice. Bracket notation such as a[b]=c becomes a nested object {"a":{"b":"c"}}. Values are decoded from percent-encoding as they are parsed.

  3. 3

    Edit and convert back

    Change the JSON and send it back to a query string. The round trip re-flattens nested objects using dot and bracket notation and re-encodes the values, which is handy for building or testing a request by hand.

  4. 4

    Spot encoding differences

    Compare how the same content is written two ways: a space as a plus sign versus as %20, and a raw comma versus %2C. Seeing both forms side by side makes it obvious why a server rejected one and accepted the other.

Key facts

  • Plus signIn application/x-www-form-urlencoded, the plus sign decodes to a space. Percent-encoded %20 is the explicit equivalent and the two are interchangeable only inside a query string.Source:HTML URL encoding
  • Repeated keysA repeated key such as a=1&a=2 has no JSON object equivalent, so it is represented as an array.Source:This tool
  • Array notationThe PHP-style a[]=1&a[]=2 is a framework convention for expressing arrays, not part of the URL standard, and different parsers handle it differently.Source:URL conventions
  • EncodingQuery values should be percent-encoded; this tool decodes %20, %2C and similar sequences back to their literal characters on parse.Source:RFC 3986

Frequently asked questions

How are repeated keys handled?

A query string can legitimately contain the same key more than once — a=1&a=2 is common when a form submits a multi-value field. A JSON object has no way to store one key twice, so the converter collapses repeated keys into an array: a=1&a=2 becomes {"a":["1","2"]}. When a key appears only once it stays a single value, so {"a":"1"} rather than {"a":["1"]}.

What is the difference between + and %20?

In the application/x-www-form-urlencoded scheme, the plus sign is an alias for a space. So name=John+Doe and name=John%20Doe decode to the same string, "John Doe". The two are interchangeable only inside a query string; if you forget that a plus is a space and treat it as a literal plus, you will misread the value. Percent-encoding (%20) is the explicit, unambiguous form.

How are nested objects represented?

Square-bracket notation maps a query string onto a nested JSON object. a[b]=c produces {"a":{"b":"c"}}, and deeper chains such as a[b][c]=d nest further. Arrays use a repeated key or the PHP-style a[]=1&a[]=2 convention, which this tool reads as {"a":["1","2"]}. The bracket style is a convention layered on top of the URL spec, not part of it, so different libraries parse it differently.

Is my data uploaded?

No. Parsing and serialisation run entirely in your browser; the query string you paste is never sent to or stored on any server. You can paste real request parameters, including anything sensitive such as tokens or session identifiers, without it leaving the page — and because the conversion is local, the result is also private by construction.

Related tools

Sponsored

This space is reserved for a sponsor.