Shard Tools

Query String to JSON

Turn a URL query string into readable JSON in your browser.

Maintained by Roshan.

Use Query String to JSON

Converts Query string or full URL into JSON in this tab. Configuration files routinely hold hostnames, keys and credentials, so nothing here is sent anywhere.

Values are never retyped as numbers or booleansGuessing types is how a converter turns a postcode of 0123 into 123, or a literal string of false into a boolean. Values are carried across as they were written, and casting is left to you where it matters.

Explore developer and data tools

Find related browser-local tools for nearby tasks without starting another search.

Browse all developer and data tools

About Query String to JSON

A long URL is close to unreadable, and reading one is a routine part of debugging anything web-facing: working out which tracking parameters an analytics link carries, why a filtered search returns the wrong results, what a callback actually received. Turning the query into JSON makes it legible in a way that squinting at ampersands never will. The one decision that matters is what to do with a repeated key, because a query string may legally contain the same parameter more than once and frequently does - that is how a set of checkbox filters is usually encoded. Keeping only the last value is the common shortcut and it silently discards data, so repeated keys become arrays here instead.

Work through the input

  1. A full URL is accepted as well as a bare query string, since that is usually what is in the clipboard. Everything before the question mark is ignored.
  2. The browser's own URL parser does the work, so percent-encoding, plus signs as spaces and Unicode all decode exactly as the browser would interpret them.
  3. A key appearing more than once becomes an array of its values, in the order they appeared, rather than collapsing to a single value.
  4. A key appearing once becomes a plain string, since wrapping every value in an array would be tedious to read and to consume.
  5. A parameter present with no value becomes an empty string, which is what it means, rather than being dropped.

When query string to json is useful

Working out what a tracking link carries

Paste the whole URL. The campaign parameters become obvious immediately, which is far quicker than reading them inline.

Debugging a filtered search

Repeated filter parameters become an array, so you can see exactly which values were applied rather than guessing from a wall of ampersands.

Check the output

Questions about Query String to JSON

Can I paste a whole URL?

Yes. Everything before the question mark is ignored, so the full address works as well as just the query.

What happens to repeated parameters?

They become an array. Keeping only the last value would silently discard the others, which is how filter selections get lost.

Are values decoded?

Yes. Percent-encoding and plus-as-space are both resolved, using the browser's own URL parser.

Does it handle bracket notation for nesting?

No. Keys with brackets are kept as literal key names rather than expanded into nested objects.

Is the URL sent anywhere?

No. It is parsed in this tab, which matters since URLs often contain session tokens.

Related tools

JSON to Query String

Turn a JSON object into a properly encoded URL query string in your browser, with arrays repeated correctly.

URL Encoder and Decoder

Percent-encode and decode URLs in your browser, choosing between encoding a value inside a URL and encoding a whole address. Shows which characters differ.

JSON Formatter and Validator

Format, minify, and validate JSON locally in your browser. Inspect keys, values, nesting depth, and root type without sending private API data to a server.