Query string to JSON — and back.
Paste a query string or a whole URL to get JSON, including nested objects and arrays like filter[brand]=Acme and size[]=8. Or paste JSON and get a query string in the array style your backend expects.
How nested keys become JSON
| Query string | JSON |
|---|---|
| tag=a&tag=b | {"tag": ["a", "b"]} |
| tag[]=a&tag[]=b | {"tag": ["a", "b"]} |
| tag[1]=b&tag[0]=a | {"tag": ["a", "b"]} |
| user[name]=Ada&user[langs][]=en | {"user": {"name": "Ada", "langs": ["en"]}} |
| q=red+shoes | {"q": "red shoes"} |
Query strings have no types: every value arrives as text. Tick “Turn numbers and true/false into JSON types” if you want page=2 as 2 rather than "2" — but your server will still receive strings.
There is no single standard for arrays
The URL and HTML standards only define flat name=value pairs. Nested keys and arrays are a convention, and frameworks disagree:
- Brackets (
tags[]=x) — PHP, Rails, and Express (which usesqs, the same library as this page). - Repeated keys (
tags=x&tags=y) — Go’surl.Values, Python’sparse_qs, Java servlets, ASP.NET. - Comma-separated (
tags=x,y) — many REST APIs; it breaks if a value contains a comma.
Pick the style your backend reads, and keep it consistent across your API.
Engine
This page uses qs 6.13.0 (BSD-3-Clause), the parser Express uses for req.query, so the JSON you see is what an Express app would get. Limits are raised to 10 levels of nesting and 100 array items. PHP’s parse_str differs in one way worth knowing: it turns dots and spaces in key names into underscores.
Sources & standards
- WHATWG URL Standard —
application/x-www-form-urlencodedparsing and serializing. url.spec.whatwg.org - qs documentation — bracket, index, repeat and comma formats. github.com/ljharb/qs
- PHP parse_str and http_build_query.
Common questions.
Paste it above (a whole URL works too). Bracket keys like user[name]=Ada become nested objects, and tags[]=a&tags[]=b or repeated keys become arrays.
There is no standard. Use tags[]=a&tags[]=b for PHP, Rails or Express, repeated keys tags=a&tags=b for Go, Python, Java or .NET, or tags=a,b if your API documents it.
Query strings carry text only. Tick the option to convert numbers and true/false for display, but parse and validate types on the server.
No. Conversion runs in your browser.
More from the toolkit.
About this page. Written and maintained by Sri Murugan Systems, the developer of urlencodedecode.com. Everything on this page runs in your browser; nothing you paste is uploaded. Uses qs 6.13.0 (BSD-3-Clause).