Skip to content

Query String Builder and Parser

Turn a query string into JSON, or build one from JSON, with repeated keys as lists.

Direction

Runs in your browser — nothing you enter is sent to a server.

How the Query String Builder and Parser works

Query → JSON: paste a query string such as ?q=red+shoes&size=9, or a whole URL, and get a JSON object. Values are decoded the way browsers read form data: + is a space, and a name that appears more than once becomes a list.

JSON → query: paste a JSON object and get a correctly encoded query string. Lists become repeated names; true, false and numbers become text; null becomes an empty value. Nested objects have no standard form in query strings, so they are refused with a suggestion.

Examples

Parsing

?q=red+shoes&size=9&size=10&empty= → {"q": "red shoes", "size": ["9", "10"], "empty": ""}.

Building

{"q": "red shoes", "size": [9, 10], "sale": true} → ?q=red+shoes&size=9&size=10&sale=true.

Frequently asked questions

Why are numbers strings after parsing?

A query string is text; size=9 and size=09 are different strings. Convert values in your code where you know their types.

How are special characters encoded?

Everything except letters, digits and *-._ is percent-encoded in UTF-8, and spaces become +: é&b becomes %C3%A9%26b.

What about a[b]=1 style names?

PHP and some frameworks read brackets as nesting, but browsers and the URL standard don't. Here the name is kept as written, for example "a[b]": "1".

URL Parser

Split a URL into scheme, host, port, path, query parameters and fragment.

Developer Tools

URL Encoder & Decoder

Percent-encode text for URLs and query strings, or decode %20-style encoded text back to readable text.

Developer Tools

JSON Formatter

Format, validate and minify JSON, with the exact line and column of any error.

Developer Tools