Skip to content
UniKit

JSON ↔ Query String Converter

Convert between a JSON object and a URL query string in both directions: non-string values are JSON-serialised first, repeated names merge into arrays, and encoding matches the browser URLSearchParams exactly.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Input

For JSON→query give an object; values are encoded with URLSearchParams (spaces become +, reserved characters become %XX). For query→JSON give a=1&b=2; repeated names are collected into an array.

Converted output

Both directions use the built-in URLSearchParams, so encoding matches the URL standard.

Enter a value to see the converted output

What this tool does

  • Build a GET query string from a JSON parameter object and append it to an API URL
  • Turn a captured query string back into JSON so the parameters are readable

Example

Input

{"q":"hello world","page":2}

Output

q=hello+world&page=2

Encoding comes from URLSearchParams: spaces become + and non-string values are JSON-serialised first.

Frequently asked questions

Why do spaces become + instead of %20?

Because the output uses URLSearchParams.toString(), which follows the application/x-www-form-urlencoded rules and encodes spaces as +. Both forms are equivalent in a query string.

How are nested objects and arrays handled?

They are JSON.stringify-ed and then encoded as a whole, so {"u":{"x":1}} becomes u=%7B%22x%22%3A1%7D. Parameters are never expanded into dotted names like u.x=1.

Are all values strings when converting back?

Yes. A query string carries no type information, so 1 comes back as the string "1"; use the string-to-number tool afterwards. Repeated names (a=1&a=2) become an array.

Do invalid escapes raise an error?

No. URLSearchParams is lenient, so a=%ZZ is kept literally as "%ZZ".

Keywords:json to query stringquery string to json

Related tools