BYTETOOLS

How to Convert a URL Query String to JSON Online

To convert a query string to JSON, paste the query string (or the whole URL) into the Query String to JSON converter and click Convert: it decodes every value, groups repeated keys into arrays, and returns pretty-printed JSON you can copy. Everything runs locally in your browser, so URLs that carry tokens or personal data are never uploaded.

Query strings and JSON describe the same thing — a set of key/value pairs — but code usually wants JSON. This guide shows exactly how to get from one to the other, including the details that matter, like full-URL input and repeated parameters.

What the converter does

Give it a query string such as a=1&b=hello%20world and it returns:

{
  "a": "1",
  "b": "hello world"
}

It uses the browser's native URL parser, decodes percent-encoded sequences (so %20 becomes a space and %26 becomes an ampersand), treats + as a space, and indents the output so it is easy to read or drop into code.

The indentation is not just cosmetic. Pretty-printed JSON is far easier to scan for a missing field or an unexpected array than a single dense line, which matters when a URL carries a dozen parameters. You can always compact it afterward with a minifier if you need it on one line for a request body.

Step by step

  1. Copy your query string, or the entire URL, from the address bar, a log line, or documentation.
  2. Paste it into the input box on the Query String to JSON converter. A leading ? — and everything before it in a full URL — is handled automatically.
  3. Click Convert.
  4. Read the pretty-printed JSON. Keys that appeared once are string values; keys that repeated are grouped into arrays.
  5. Click to copy the JSON into your editor, request body, or another tool.

How repeated keys and full URLs are handled

Two behaviors deserve a closer look. When a key repeats — for example tag=a&tag=b — the values are collected into an array, so you get "tag": ["a", "b"] instead of losing the first value. And when your input is a whole URL like https://shop.example/search?q=shoes&page=2, the converter ignores everything up to and including the ?, so you can paste a link straight from your browser without trimming it first.

These two rules cover almost every real-world input. A query string copied from documentation, a full URL pulled from your address bar, and a raw parameter list from a server log all convert the same way, and multi-valued filters survive as arrays instead of silently overwriting each other.

InputOutput
q=shoes{ "q": "shoes" }
tag=a&tag=b{ "tag": ["a", "b"] }
name=Jane%20Doe{ "name": "Jane Doe" }
https://x.io?ref=1{ "ref": "1" }

Try the Query String to JSON converter — free and 100% in your browser.

FAQ

Do I have to remove the domain and path first?

No. If your input contains a ?, everything before it is discarded automatically, so a full URL works the same as a bare query string.

Are all values strings in the output?

Yes. Query strings carry text, so numbers and booleans come out as strings like "2" or "true". Convert them to real types in your own code if needed.

What does a repeated key become?

An array. id=1&id=2 becomes "id": ["1", "2"], so no value is dropped when a parameter appears more than once.

Can I convert without an internet connection?

Yes. The converter runs entirely client-side and ByteTools works as a PWA, so once loaded it keeps converting offline.

Related free tools

Built by ByteVancer

ByteTools is a free product of ByteVancer, a software and web development studio building web apps, SaaS, and custom software. If you are wiring query data into a real application, explore how ByteVancer can help build it end to end.