Skip to main content
NyankoTools

Query String ⇔ JSON Converter

Turn a query string such as a=1&b[]=2&b[]=3 into JSON, or JSON back into a query string. You can paste a leading ? or a full URL and only the query part is used. To split and edit a single URL, use the URL Parser; to tidy the JSON, use the JSON Formatter.

🔒 Runs in your browser · Your data is never sent to a server

How to use

  1. Pick query string to JSON, or JSON to query string, in "Direction".
  2. Paste the source into "Input". A full URL works too.
  3. Switch options such as array style or type conversion if you need them.
  4. The output appears in "Result"; take it with "Copy".

Notes

  • A query string has no types, so by default every value is output as a string. Turn on type conversion to get numbers and booleans (007, 1e3 and integers over 15 digits stay strings to avoid losing precision).
  • When reading a query string, b[], b[0] and b=1&b=2 are all recognized automatically. You only choose the style when writing one from JSON.
  • Arrays that contain objects always use b[0][name] indexes so the structure survives. Empty arrays and empty objects cannot be represented and are omitted.
  • null is written without an equals sign, as in b, and comes back as null when type conversion is on.
  • Bracket keys follow the conventions of qs (Node.js) and PHP, but details differ between implementations, so check what your target server expects.
  • Your data is processed in the browser and is never sent to a server.

Glossary

Query string

The part of a URL after the ?, made of key=value pairs joined by &. It carries form submissions and search filters.

Percent-encoding

Writing characters that are unsafe or reserved in URLs as % plus hex digits, such as %E3%81%82. In form encoding a space may also appear as +.

Prototype pollution

An attack that abuses special keys such as __proto__ to alter shared object behavior, a classic risk when parsing nested query strings. This tool builds results with prototype-less objects, so it is not affected.

FAQ

Can it read arrays written as b[], b[0] or b=1&b=2?

Yes. When converting a query string to JSON, all three styles are detected automatically and give the same array. You only choose a style when writing a query string from JSON.

Why do numbers and true come out as the strings "1" and "true"?

A query string carries no type information. Turn on the type conversion option to get 1 and true. Values such as 007, 1e3 and integers over 15 digits stay strings so the original text is not altered.

Is + treated as a space?

By default yes, as in form submissions. If you need a literal + like in a URL path, turn the option off. %20 is always a space.

Why are arrays of objects written as b[0][name]?

With b[][name]=x&b[][name]=y it would be impossible to tell where one element ends and the next begins. Index notation keeps the structure recoverable.

Is a key named __proto__ safe?

Yes. Results are stored in objects without a prototype, so shared objects cannot be modified, and __proto__ is just an ordinary key in the output.

Share this page

↑↓ Select Enter Open Esc Close