JSON to query string

Input
Output

JSON to Query String

Turn JSON into URL parameters like filters[brand]=x&page=2, or switch direction to read the parameters of any URL as JSON.

Example: search filters as URL parameters

A search form's state as JSON, with a nested filters object and an array. Nested keys use brackets, the array is written as filters[size][0] and filters[size][1], and the space is encoded:

Input

{
  "q": "red shoes",
  "filters": {
    "brand": "puma",
    "size": [
      8,
      9
    ]
  },
  "page": 2,
  "inStock": true
}

Output

q=red%20shoes&filters[brand]=puma&filters[size][0]=8&filters[size][1]=9&page=2&inStock=true

How do I use the JSON to query string?

  1. Paste JSON, or choose Query string → JSON and paste a URL.
  2. Choose how arrays are written.
  3. Copy the result.

What does the JSON to query string do?

  • Nested objects with bracket keys
  • Three array styles: a[0]=x, a[]=x or a=x&a=y
  • Numbers and booleans detected when reading

When to use the JSON to query string

Search pages, filters and GET APIs keep their state in the URL. Turning a JSON object into a query string is how you build those links from code, tests or a design doc, and reading a long URL back as JSON is the quickest way to see what a page or tracking link actually sends.

Nested objects use bracket keys (filters[brand]=puma), which PHP, Rails, Express's qs and most web frameworks read back as nested objects. Arrays can be written three ways: a[0]=x with indexes, a[]=x, or a=x&a=y repeated; pick the one your server expects. Reading goes the other way: paste a whole URL, and numbers and true/false become JSON values unless you keep everything as text.

Frequently asked questions

Which array style should I use?
Use whatever the server parses: a[]=x is PHP's and Rails's style, a=x&a=y suits Go, Python and many APIs, and a[0]=x keeps the order explicit. If unsure, try reading your server's own URLs with Query string → JSON.
Why aren't the brackets encoded?
Brackets in parameter names are left as [ ] because servers read them that way and the URL stays readable; browsers send them fine. Values are fully encoded.
Can I paste a whole URL?
Yes. When reading, everything before the ? is ignored.
Is my data uploaded?
No. Bracely runs entirely in your browser, so nothing you paste or open leaves your device.

More JSON tools

Bracely has 108 JSON tools in one page. Related ones:

Runs entirely in your browser. Nothing you paste is uploaded. Made by Saurabh Pagrut · About · Privacy policy
Last updated · Version 6.7 · Changelog
Saurabh Pagrut on GitHub · LinkedIn · X · YouTube · Instagram