# JSON to Query String

Build a URL query string from a JSON object. Every value is percent-encoded, nested objects use bracket notation such as filter[status]=open, and arrays are written as repeated keys, with brackets, with indices or as comma separated lists. Choose %20 or + for spaces to match the server that reads the URL.

## Frequently asked questions

### Which array formats are available?

Repeat writes ids=1&ids=2, brackets writes ids[]=1&ids[]=2, indices writes ids[0]=1&ids[1]=2 and comma writes ids=1,2. Repeat is what URLSearchParams and most HTTP clients send; PHP and Rails expect brackets or indices.

### How are nested objects written?

With bracket notation: {"filter": {"status": "open"}} becomes filter[status]=open. Deeper objects add more brackets, such as a[b][c]=1.

### Should spaces be %20 or +?

Both mean a space in a query string. %20 is correct in any part of a URL, while + is what HTML forms send. Most servers accept both, so choose the one your server or API documentation uses.

### Why are brackets encoded as %5B and %5D?

Square brackets are reserved characters in URLs, so they are percent-encoded by default, as PHP's http_build_query and the qs library do. Turn on readable brackets to keep them as [ and ], which most servers accept as well.

### Which characters are left unencoded?

Letters, digits and the characters - _ . ! ~ * ' ( ) are left as they are. Everything else, including &, =, # and non-ASCII letters, is percent-encoded as UTF-8.

### How are null and booleans written?

true, false and numbers are written as text, for example active=true. null becomes an empty value, such as note=.

Your ad here?

[Email us](mailto:hi@dennn.is?subject=Advertising%20on%20OneClick%20Pro)

[Ad 433 tools for your AI agents through one MCP server.](https://multitaskai.com/?ref=oneclickpro)
