Query String to JSON
Paste a query string or a full URL to get JSON: repeated keys and key[] become arrays, + and %20 decode to spaces, with optional nesting and number types. How it works
Use the Query String to JSON
Paste a query string, one starting with ?, or a whole address (the part after the first ? is read and the #fragment is dropped). Up to 1,000,000 characters. A + and %20 both decode to a space, %2B to a plus sign. Pairs are split on & only. A key that repeats, or ends in [], becomes an array. Names in brackets such as a[b] stay one flat key unless you tick the box below.
6 pairs read, 5 keys in the JSON.
About the Query String to JSON
The query string name=John+Doe&age=30&tag=red&tag=blue becomes {"name":"John Doe","age":"30","tag":["red","blue"]}: a + is a space, a key that repeats becomes an array, and every value stays a string. Paste a bare query string or a whole URL; the converter reads the part after the first ? and drops the #fragment.
Query strings and the JSON they give
| Query string | JSON (written on one line) |
|---|---|
| name=John+Doe&age=30&city=New%20York&tag=red&tag=blue&colors[]=green | {"name":"John Doe","age":"30","city":"New York","tag":["red","blue"],"colors":["green"]} |
| https://example.com/search?q=cron+job&page=2#results | {"q":"cron job","page":"2"} |
| a[b]=1&a[c]=2 | {"a[b]":"1","a[c]":"2"} |
| a=1&a[]=2 | {"a":["1","2"]} |
| a=1;b=2 | {"a":"1;b=2"} |
| x=%E2%82%AC&y=%2B1 | {"x":"€","y":"+1"} |
| __proto__=x&constructor=y | {"__proto__":"x","constructor":"y"} |
The first row is the text the page opens with: 6 pairs and 5 keys. With both boxes unticked, brackets with a name inside are not nested, and a semicolon never separates pairs.
With Nest bracket keys or Infer numbers and booleans ticked
| Query string | Box ticked | JSON (written on one line) |
|---|---|---|
| a[b]=1&a[c]=2 | Nest | {"a":{"b":"1","c":"2"}} |
| a[b][c]=1 | Nest | {"a":{"b":{"c":"1"}}} |
| a[0]=x&a[1]=y | Nest | {"a":["x","y"]} |
| a=1&a[b]=2 | Nest | {"a":"1","a[b]":"2"} |
| name=John+Doe&age=30&tag=red&tag=blue | Infer | {"name":"John Doe","age":30,"tag":["red","blue"]} |
| n=-4&x=2.5&ok=true | Infer | {"n":-4,"x":2.5,"ok":true} |
| zip=007&p=1.50&e=1e3&T=True | Infer | {"zip":"007","p":"1.50","e":"1e3","T":"True"} |
a=1&a[b]=2 clashes (a cannot be both a string and an object), so a[b] stays a flat key and a note says so. Infer converts only text that is already the plain form of a number, and only the lowercase words true and false.
Frequently asked questions
- How do I convert a URL query string to JSON?
- Paste the query string, or the whole URL, into the box; the JSON updates as you type. https://example.com/search?q=cron+job&page=2#results gives {"q":"cron job","page":"2"}, with notes that the part after the first ? was read and the fragment dropped.
- Does a[b]=1 become a nested object?
- Only when you tick Nest bracket keys. Unticked, a name inside the brackets stays one flat key, so a[b]=1&a[c]=2 gives {"a[b]":"1","a[c]":"2"}, and only empty brackets at the end make an array: a=1&a[]=2 gives {"a":["1","2"]}. Ticked, a[b]=1&a[c]=2 gives {"a":{"b":"1","c":"2"}} and a[0]=x&a[1]=y gives {"a":["x","y"]}. Nesting stops at 10 levels.
- Why are numbers in quotes in the JSON?
- A query string carries only text, so age=30 gives "30", a string. Tick Infer numbers and booleans to write age=30 as 30 and ok=true as true. Text that would change if written as a number, such as 007 or 1.50, stays a string, because a ZIP code or a price is not always a number.
- Is + a space or a plus sign in a query string?
- A space. + and %20 both decode to a space, as the WHATWG URL Standard’s form parser reads them. Write %2B for a literal plus: y=%2B1 gives "+1".
- What happens to a broken percent sign?
- p=100% keeps the % as typed and adds a note. An escape that is not valid UTF-8, such as %FF, becomes U+FFFD (�), also with a note.
Related Tools
View all toolsSubnet Mask Calculator
Subnet calculator for IPv4: enter an address and a mask or prefix such as /24 to get the network, broadcast address, host range, usable hosts and wildcard mask.
CIDR Calculator
Enter an IPv4 CIDR block such as 192.168.1.0/24 for its IP range, netmask, broadcast address and usable hosts, split it into subnets or turn a range into CIDR.
JWT Decoder
Paste a JSON Web Token to read its header, its payload and the exp, nbf and iat times in UTC. The signature is shown but not checked: nothing is verified.
URL Parser
Split a URL into protocol, user name, password, host, port, path, query and hash, see each query parameter decoded, and whether the port was written.
JSON to Query String
Turn a JSON object into a URL query string: arrays as repeated keys, [], [0], a comma list or JSON, nested objects as user[name], user.name or JSON.
UTM Builder
Build a campaign URL with utm_source, utm_medium, utm_campaign, utm_id, utm_term and utm_content. Source, medium and campaign are required.