JSON to Query String

Convert JSON to query string


          

What Is This Tool?

The JSON to Query String tool converts a JSON object into a URL query string, percent-encoding every value with encodeURIComponent. Nested objects and arrays are supported using a bracket convention (key[0]=a, key[nested]=value), similar to what many web frameworks and the popular "qs" library use. Everything runs locally in your browser.

How to Use

1

Paste a JSON object into the input box.

2

Click Convert.

3

Copy the resulting query string and append it to a URL.

Features

  • Percent-encodes keys and values with encodeURIComponent
  • Arrays convert to the key[0]=, key[1]= bracket convention
  • Nested objects convert to the key[nested]= bracket convention
  • Clear error messages for invalid or non-object JSON
  • 100% client-side — nothing is uploaded anywhere

Examples

Input:

{
  "search": "shoes",
  "page": 2,
  "tags": ["red", "sale"]
}

Output:

?search=shoes&page=2&tags[0]=red&tags[1]=sale

Common Use Cases

  • Building a query string for an API request from a JSON payload
  • Converting filter or search state stored as JSON into a shareable URL
  • Testing how a backend that uses the bracket convention would parse your data
  • Quickly percent-encoding a set of parameters without writing code

Frequently Asked Questions

Is the bracket notation for arrays and nested objects a web standard?

No. There's no official standard for representing arrays or nested objects in a query string. The key[0]=, key[nested]= convention used here is common (used by PHP, Rails, and libraries like "qs" for Node.js) but not universal — some backends expect repeated keys instead (key=a&key=b) or a different convention entirely.

Why must the input be a JSON object, not an array?

A query string is a flat sequence of key=value pairs, so the top level needs named keys to convert into parameter names. Wrap a top-level array in an object with a key first, e.g. {"items": [...]}.

How deeply can objects be nested?

There's no hard limit; the converter recurses through nested objects and arrays of any depth, chaining bracket segments like a[b][0][c]=value.

Are special characters in values encoded?

Yes. Every value (and key) is passed through encodeURIComponent, so spaces, ampersands, slashes, and other reserved characters are percent-encoded correctly for use in a URL.

What happens to null or boolean values?

They're converted to their string form (null becomes the text "null", true/false become "true"/"false") before encoding, since a query string can only hold text.

Is my JSON data uploaded anywhere?

No. The conversion happens entirely in your browser using JavaScript. Nothing is sent to a server.