JSON to Query String

Build an encoded query string from JSON.

Runs in your browser Instant No sign-up
Arrays
Nested objects
JSON input
Query string
Reverse

Paste, type or drop a file — output appears as you type.

Waiting for input
Processed locally · nothing is uploadedProcessed locally

How to use the JSON to query string converter

  1. Paste a JSON object into the left pane. The encoded query string appears as you type.
  2. Arrays: repeated keys, [] brackets, indexes or commas.
  3. Nested objects: a[b]=1 brackets or a.b=1 dots.
  4. Leading ?: add a ? so the result can be appended straight to a URL.
  5. Under More options: Spaces as + for form encoding.
  6. Copy the result or Download it as query.txt.

The status bar shows how many parameters were written and the total length, which helps you stay under URL length limits.

Example

{
  "q": "mechanical keyboard",
  "tags": ["wireless", "rgb"],
  "price": { "min": 50, "max": 200 },
  "in_stock": true
}

becomes

q=mechanical%20keyboard&tags=wireless&tags=rgb&price[min]=50&price[max]=200&in_stock=true

Encoding rules

  • RFC 3986 percent-encoding. Everything except unreserved characters (letters, digits, -, ., _, ~) is encoded, including !, ', (, ) and *, which some encoders leave alone.
  • Unicode is encoded as UTF-8, so é becomes %C3%A9.
  • null becomes an empty value (key=); true, false and numbers are written as text.
  • Big integers stay exact, because the JSON is parsed losslessly.

When to use it

  • Building API requests from a JSON payload, for example search or filter endpoints.
  • Writing test URLs with many parameters without escaping them by hand.
  • Checking how a client library encodes arrays and nested objects.

Matching your server

There is no single standard for arrays and nested objects in query strings, which is why the tool offers several styles. Express with the qs parser, PHP and Ruby on Rails read brackets; Go’s net/url, Python’s urllib.parse.parse_qs and Java servlets read repeated keys as a list; some APIs document comma-separated lists instead. If you are not sure, convert a URL your server already accepts with Query String to JSON, then choose the style that produces the same keys. Keep URLs under about 2,000 characters for older proxies and browsers, and send large payloads in a request body instead.

Need the reverse? Click Reverse or open Query String to JSON. To encode or decode a single value, use URL Encode / Decode, and to inspect a complete URL use the URL Parser.

Frequently asked questions

How are arrays written?

Pick the style your server expects: a=1&a=2 (repeated keys, the default, which most frameworks read as a list), a[]=1&a[]=2 (PHP and Rails), a[0]=1&a[1]=2 (indexed), or a=1,2 (comma-separated). Arrays that contain objects always use indexes, since the other styles can't express them.

How are nested objects written?

As a[b]=1 by default, the bracket convention of PHP, Rails and the qs library, or as a.b=1 if you choose dots, which Spring and some Go and .NET binders read.

Why are the brackets not percent-encoded?

Keys keep [ and ] readable, like the qs library's encodeValuesOnly mode, because servers accept them as written and a link like tags[]=x is easier to read than tags%5B%5D=x. Everything else in keys and values is percent-encoded.

Should spaces be %20 or +?

%20 is the default and is correct everywhere in a URL. Turn on "Spaces as +" (under More options) to match HTML form encoding (application/x-www-form-urlencoded), which some older servers expect.

Is my data uploaded?

No. The query string is built in your browser and nothing you paste leaves your device.

Last updated