How to Convert a Query String to JSON (and Back)
A URL query string — the part after the ? — is a flat list of key/value pairs. Turning it into JSON makes it easy to read and manipulate; turning JSON back into a query string helps you build URLs. Here's how the conversion works.
Pairs become properties
Each key=value pair becomes a property, with percent-encoding and + decoded:
name=Ada+Love&role=admin
{ "name": "Ada Love", "role": "admin" }
A leading ? is ignored, so you can paste a full query string or just the part after the ?.
Repeated keys become arrays
When a key appears more than once — or uses a [] suffix — the values collapse into an array so nothing is lost:
role=admin&role=dev&tags[]=a&tags[]=b
{ "role": ["admin", "dev"], "tags": ["a", "b"] }
Bracket notation nests objects
Bracket notation parses into nested objects, to any depth:
filter[status]=open&filter[sort][by]=date
{ "filter": { "status": "open", "sort": { "by": "date" } } }
Converting JSON back to a query string uses the same convention — nested objects become parent[child] and arrays become repeated key[] pairs.
Values stay strings
Query strings carry only text, so every value is kept as a string (page=2 is "2"). That keeps the conversion reversible: JSON → query string → JSON gives you back what you started with.
Related
Working with URLs? See URL Encoding Explained and TOML to JSON.
Try it
Paste a query string or JSON and convert instantly — everything runs in your browser, nothing uploaded.