Guide
Building query strings from JSON objects without surprises
Passing structured data in a URL is a compromise: a query string is a flat list of text pairs, while the data you have is usually an object with lists and nested parts. Different libraries squeeze one into the other in different ways, and mismatches between a client and a server cause filters that silently do nothing. This page produces the form you choose and shows it.
Array styles
Four conventions are in use. Brackets, tags[]=a&tags[]=b, are what PHP, Rails and many Node libraries produce. Repeated keys, tags=a&tags=b, are what plain HTML forms send for multiple selections. Indices, tags[0]=a&tags[1]=b, keep the order explicit and are the default of some libraries for arrays of objects. A comma list, tags=a,b, is compact and common in public REST APIs, but it breaks if a value contains a comma. The selector at the top lets you switch while watching the output.
Nested objects
An object inside an object is written with bracket keys: {“filter”: {“size”: {“min”: 38}}} becomes filter[size][min]=38. Servers that understand the convention rebuild the object; servers that do not see a parameter with a strange name. If an API instead expects dotted names or a single JSON string in one parameter, this page is not the right tool, though you can paste the JSON into the URL encoder for the second case.
Encoding
Every key and value is converted to UTF-8 and percent-encoded. JavaScript’s encodeURIComponent leaves the characters ! ’ ( ) * alone; the page escapes them as well, because some parsers and proxies treat them as special. A space is written %20 by default, which is valid anywhere in a URL. The “Space as +” option writes a plus sign instead, the form used by HTML form submissions, which is only right in a query string.
Other options
“Skip null values” drops pairs whose value is null, since there is no standard way to represent null in a query string. “Sort keys” orders the pairs alphabetically, which helps when comparing two URLs or building a stable cache key. A base URL, if you enter one, is joined with a question mark, or with an ampersand if it already contains one, and the page shows the full address. Booleans and numbers are written as text, so true appears as true.
A worked example
The Sample button loads an object with q, page, tags, filter, instock and coupon. With bracket arrays the output is q=red%20shoes%20%26%20boots&page=2&tags%5B%5D=sale&tags%5B%5D=new&filter%5Bcolor%5D=red&filter%5Bsize%5D%5Bmin%5D=38&filter%5Bsize%5D%5Bmax%5D=44&instock=true. The coupon pair is missing because its value is null and skipping is on, and the ampersand inside “red shoes & boots” is escaped so it does not split the pair. A small object with a list and a nested key gives tags=a&tags=b&n%5Bx%5D=1 with repeated keys and tags=a,b&n%5Bx%5D=1 with a comma list.
Limits
The page produces strings; it cannot know how your server will read them, so test against the real endpoint. Arrays of objects work with brackets and indices but are not understood by every parser. Values that are not JSON, such as dates, are written as the text you provide. Very large objects produce very long addresses, and browsers, proxies and servers limit URL length, commonly to a few thousand characters, so send big payloads in a request body instead.
Related tools
- Query String to JSON parses the result back into an object.
- URL Encoder escapes a single value.
- JSON Formatter checks and tidies the JSON before conversion.
- cURL to Fetch helps turn a tested request into code.
Checked against the current version of the JSON to Query String on .

