Parse query strings into JSON using the URL standard URLSearchParams decoder. Duplicate keys become JSON arrays; single values stay strings. Leading ? characters are stripped automatically so you can paste either raw query text or a fragment copied from a full URL.
How it works
A leading ? is removed if present. The remainder is fed to URLSearchParams, which splits on & and decodes key=value pairs per the application/x-www-form-urlencoded rules. When a key appears once, the JSON value is a string; when it appears multiple times, values are collected into a JSON array preserving insertion order.
When to use it
- Inspect query parameters from agent-fetched URLs and redirect chains
- Convert
application/x-www-form-urlencodedfragments to JSON for tooling - Debug OAuth callbacks, webhook query payloads, and analytics tags
- Round-trip with build-query-string to validate encoding assumptions
Example
page=2&q=hello&q=world becomes {"page":"2","q":["hello","world"]} in the output textarea. A lone q=hello yields "q":"hello" without an array wrapper.
Limitations
Paste only the query portion—not a full URL with scheme and host (strip everything before ?). Nested JSON objects are not supported in query strings; values are always strings (or arrays of strings). Plus signs decode as spaces per the URL standard, which may differ from some custom parsers.