FormatterHQ

Query String to JSON

Paste a full URL or just the query string and get the parameters as JSON. Percent-encoding is decoded, repeated keys become arrays and bracket keys become nested objects.

Input TEXT
Output JSON
Ready.

How to use the Query String to JSON

  1. Paste a full URL (https://…?a=1) or only the query string (a=1&b=2).
  2. Tick Convert numbers & booleans if you want 42 and true as JSON types instead of strings.
  3. Click Convert.
  4. Copy the JSON or change the indentation to suit your code.

Decode URLs with the query string to JSON parser

This query string to JSON tool reads the parameters of a URL and turns them into a structured JSON object. It decodes percent-encoding and + spaces, collects repeated keys into arrays, and understands the bracket notation used by PHP, Rails, Express's qs and jQuery's $.param, so filter[price][max]=120 becomes a nested object instead of a key full of brackets.

Example

https://shop.example.com/search?q=running+shoes&size=42&color[]=red&color[]=blue&filter[brand]=acme&filter[price][max]=120&page=2#results

Output with the default options:

{
  "q": "running shoes",
  "size": "42",
  "color": ["red", "blue"],
  "filter": {
    "brand": "acme",
    "price": { "max": "120" }
  },
  "page": "2"
}

The scheme, host, path and #results fragment are ignored; only the query is parsed. That makes it easy to inspect a long tracking link, a search results URL or a redirect captured in your browser's network panel.

Supported syntaxes

  • Repeated keys: tag=a&tag=b gives "tag": ["a", "b"], the way most frameworks read them.
  • Empty brackets: color[]=red&color[]=blue always produces an array, even with one item.
  • Indexed arrays of objects: items[0][sku]=MUG&items[0][qty]=2&items[1][sku]=CAP builds [{"sku": "MUG", "qty": "2"}, {"sku": "CAP"}].
  • Keys without values: flag and empty= both give an empty string.
  • Semicolons are accepted as separators as well as &.

How servers read the same query

The JSON here follows the common bracket conventions, but back ends do not agree on everything, especially repeated keys without brackets:

Readertag=a&tag=b becomes
PHP $_GET"b": the last value wins unless the key is written tag[]
Express with qs["a", "b"]
Python urllib.parse.parse_qs{"tag": ["a", "b"]}; every value is a list, even a single one
JavaScript URLSearchParamsget("tag") returns "a"; getAll("tag") returns both

If a parameter arrives with only one value on your server, check which of these rules applies before suspecting the client.

Convert numbers & booleans

Off by default, because every URL value is really text, and your server sees strings. Turn it on to get "limit": 10 and "debug": true, which is handy when building test fixtures. Values with leading zeros, such as zip=02134, stay strings either way.

Edge cases

  • Encoded brackets like filter%5Bbrand%5D=acme are decoded before parsing and still nest correctly.
  • An encoded plus (%2B) becomes a literal +, while a bare + becomes a space, per form encoding.
  • Broken percent-encoding such as %E0%A4%A is kept as written instead of failing the whole conversion.
  • UTF-8 characters are decoded: Jos%C3%A9 becomes José.

To break a URL into protocol, host, path and fragment as well, use the URL parser. To go the other way, build a query from an object with JSON to query string, or decode a single value with URL decode.

Privacy

Parsing happens in your browser. URLs often carry tokens, email addresses or session IDs, and none of it is uploaded.

Frequently asked questions

Can I paste a full URL instead of just the query string?
Yes. Everything up to the ? and anything after # is ignored, so you can paste a link straight from the address bar or a log file.
How are repeated parameters handled?
A key that appears more than once becomes an array of its values in order, so tag=a&tag=b gives ["a", "b"]. Keys ending in [] always become arrays, even with a single value.
Does it support nested parameters like filter[price][max]?
Yes. Each bracket segment adds a level of nesting, and numeric or empty brackets create arrays. This matches the format PHP and the qs library use.
Why are my numbers strings in the JSON?
Query string values are text by definition, so the default output keeps them as strings. Tick Convert numbers & booleans to turn plain numbers and true or false into JSON types.

Last updated October 3, 2026

Related tools