How to convert a query string to JSON
Choose a direction — Query → JSON or JSON → Query — paste your data on the left, and the converted result appears live on the right. In query-to-JSON mode you can paste a bare query string such as a=1&b=2, the same string with a leading ?, or an entire URL like https://example.com/path?a=1&b=2 — only the part after the question mark is read. The output is pretty-printed JSON you can copy straight into code or a test fixture. Counters under each pane show how many parameters and how many characters you are working with.
Repeated keys and arrays
Query strings allow the same key to appear several times — pagination, filters and multi-select forms all do it, for example tag=js&tag=css&tag=html. With Repeated keys as arrays turned on (the default), those collapse into a single JSON array: "tag": ["js", "css", "html"], which is what most code expects. Turn the option off and only the last value for each key is kept, matching the behaviour of code that reads a single value per parameter. Converting back, any array value in your JSON is expanded into one key=value pair per element, so a round-trip preserves the structure.
Encoding and decoding
Real query strings are percent-encoded: spaces become %20 or +, and reserved characters such as &, = and / are escaped. This tool decodes all of that for you, including the form-encoding convention where a literal + means a space, so the JSON shows the true human-readable values. When you convert JSON back to a query string, every key and value is re-encoded with encodeURIComponent, producing a string that is safe to drop straight into a URL without breaking it.
Building a query string from JSON
Switch to JSON → Query and paste a flat JSON object. String, number and boolean values are written directly; array values are expanded into repeated keys; and null is written as an empty value. If the JSON does not parse, the status line reports the error so you can fix it. This direction is handy for assembling tracking links, building API requests by hand, or turning a saved settings object back into a shareable URL — all without a server seeing your parameters.
Why convert locally
Query strings frequently carry session tokens, signed URLs, API keys and personal identifiers, which makes pasting them into an online converter or an AI chatbot a quiet data leak. Because this tool is plain JavaScript running in your tab, nothing is transmitted: parsing uses the browser's own URLSearchParams and JSON engines, so the output is the same standards-compliant result your code would produce, every time. It is instant, works offline, and leaves no trace once you close the tab.
Frequently asked questions
- How are repeated query keys handled?
- With arrays on,
tag=a&tag=bbecomestag: ["a","b"]; with it off, only the last value is kept. - Can I paste a whole URL?
- Yes — only the part after the
?is parsed. A bare query, with or without a leading?, also works. - Does it decode percent-encoding?
- Yes — values are URL-decoded (including
+as space) and re-encoded withencodeURIComponenton the way back. - Is my data uploaded?
- No. Everything runs locally, safe for query strings that contain tokens or IDs.