About the Query String Parser tool
Query strings are the key=value pairs after the ? in a URL, and they are also the body format of classic HTML form posts. Reading a long one by eye is hard, and building one by hand means remembering to percent-encode every value. This tool converts query strings to JSON and JSON back to query strings.
In the parsing direction you can paste either a bare query string or a complete URL; everything before the ? and after the # is ignored. Pairs are split on & (and ;), percent-escapes are decoded, and + can be treated as a space as HTML forms do. Repeated keys like brand=acme&brand=peak become arrays, and with nesting on, PHP and Rails style keys such as size[]=9, price[min]=50 or items[0][id]=7 become nested arrays and objects. An optional switch turns numeric and true/false values into real JSON numbers and booleans.
In the building direction, a JSON object is turned into a properly encoded query string. Nested objects use bracket keys, and arrays can be written as a[]=1&a[]=2, a=1&a=2, a[0]=1&a[1]=2 or a=1,2, so you can match whatever your backend expects. Spaces can be written as + or %20. Everything runs locally.
How to use Query String Parser
- Pick a “Direction”: “Query string → JSON” or “JSON → query string”.
- Paste a query string, full URL or JSON object into the input, or click “Load sample”.
- For parsing, set “Decode + as space”, “Nest a[b]=1 and a[]=1” and “Convert numbers & booleans”.
- For building, choose the “Array format”, “Encode spaces as +” and “Percent-encode [ ]”.
- Copy or download the result from the output pane.
Features
Both directions
Parse query strings into JSON or build encoded query strings from JSON.
Arrays and nesting
Handles a[]=1, repeated keys and nested a[b][c]=d bracket syntax.
Four array styles
Brackets, repeated keys, indexed keys or comma-separated values.
Correct encoding
Percent-encoding with a choice of + or %20 for spaces.
When to use it
- Read the filters in a long e-commerce search URL.
- Build a query string for an API request from a JSON object.
- Convert a form-encoded request body from browser dev tools into JSON.
- Check how a PHP or Rails backend will see nested form fields.
Frequently asked questions
How are repeated keys handled?
When the same key appears more than once, such as tag=a&tag=b, the values are collected into an array: {"tag": ["a", "b"]}.
Should spaces be + or %20?
In form-encoded data (application/x-www-form-urlencoded) + means space. In other parts of a URL, %20 is safer. Most servers accept both in query strings.
Which array format should I use?
It depends on the server. PHP and Rails expect a[]=1, many Java and Go frameworks read repeated keys a=1&a=2, and some APIs accept comma-separated values. Check your API’s documentation.
Why are my numbers strings?
Query strings carry only text, so values are strings by default. Turn on “Convert numbers & booleans” to get JSON numbers and booleans instead.