Query String Parser

Turn a query string into readable JSON.

Input
URL input
Output
Result
Options

Spaces per level of nesting.

About this tool


Query strings become unreadable quickly, a tracking URL with a dozen encoded parameters is effectively opaque. This converts one into JSON with every value decoded, so you can actually see what is being passed.

You can paste a full URL, a ?-prefixed query, or a bare key=value string; the query portion is extracted either way.

How to use it

  1. Paste or upload your urlDrop a file onto the input pane, use the file picker, or paste the text directly.
  2. Adjust the options if neededThe defaults suit most input; open Options to change the behaviour.
  3. ParsePress Parse, or use Ctrl+Enter (Cmd+Enter on macOS).
  4. Copy or downloadCopy the result, or download it as a .json file.

Worked examples


Each example below is executed against this tool by the test suite, so what you see is what the tool actually produces.

A full URL with repeated keys

Input

https://example.com/search?q=hello%20world&tag=a&tag=b&page=2

Output

{
  "q": "hello world",
  "tag": [
    "a",
    "b"
  ],
  "page": "2"
}

The encoded space is decoded, and the repeated tag parameter becomes an array.

What to watch for


The details that decide whether a conversion is correct, and where information can be lost without any error being raised.

Values are percent-decoded
Each value is decoded, so %20 becomes a space and %C3%A9 becomes é. A + is treated as a space, which is correct for query strings because that is how HTML form submissions encode them.
Repeated keys become arrays
A query string may repeat a key, tag=a&tag=b is how HTML forms submit multiple checkbox values. Those are grouped into an array rather than having one silently overwrite the other, which matches how server frameworks parse them.
Bracket notation is not expanded
Some frameworks encode structure as user[name]=Ada. That is a convention rather than part of the URL standard, so the key is reported literally as "user[name]" instead of being guessed into a nested object. Different frameworks parse that syntax differently, so inventing a structure would be misleading.
Valueless and empty parameters
A bare flag such as ?debug gets an empty string, as does ?debug=. The URL standard does not distinguish the two, so neither does this, if that distinction matters in your application, it is a convention your code imposes rather than something the URL records.

Limitations


  • Does not expand bracket or dot notation into nested objects.
  • All values are strings, since query strings are untyped.
  • Processing happens in your browser, so very large inputs are bounded by available memory. Files above roughly 10 MB are handled but will feel slower, and multi-hundred-megabyte files are better suited to a command-line tool.

Questions


Can I paste a whole URL?
Yes. A full URL, a ?-prefixed query, or a bare key=value string all work, the query portion is extracted automatically.
Why is user[name] not nested?
Bracket notation is a framework convention, not part of the URL standard, and different frameworks interpret it differently. The key is reported literally rather than guessed.
Why are all my values strings?
Query strings have no types, everything is text. page=2 is the string "2". Convert types in your own code, where you know what each parameter means.