JSON to Query String
Convert flat JSON to a URL query string and back. Supports common array conventions: tags[]=a&tags[]=b (PHP), tags=a&tags=b (Rails/many), tags=a,b (CSV).
How to use the JSON to Query String
Pick direction. JSON→Query handles arrays via the chosen convention; Query→JSON auto-detects which convention the source uses (groups repeats into arrays, parses foo[] and foo[0] notation).
Converting JSON and query strings
A URL query string and a flat JSON object carry the same kind of data, but moving between them by hand means wrestling with percent-encoding and, worst of all, arrays — because there is no single agreed way to encode them. PHP expects tags[]=a&tags[]=b, Rails and many others repeat the key as tags=a&tags=b, and some APIs want a comma-joined tags=a,b.
This converts flat JSON to a query string and back, with the array convention selectable and percent-encoding handled per RFC 3986. Going the other way it auto-detects which convention the source used. For converting JSON into a hierarchical wire format instead of a query string, the JSON to XML converter handles nested structures.
Common use cases
- Build a request URL — turn a params object into a query string.
- Parse a URL — convert a query string back into a JSON object.
- Match a framework — choose the array style PHP, Rails, or your API expects.
- Encode safely — get correct RFC 3986 percent-encoding.
- Debug params — read a messy query string as structured JSON.