Skip to content

Query String Parser

Convert query strings to readable JSON and flat JSON objects back to encoded query strings while preserving repeated keys.

Privacy: your files never leave your device. All processing happens locally in your browser.

How to use

  1. 1.Choose query-to-JSON or JSON-to-query direction.
  2. 2.Paste a query component or a flat JSON object and run the conversion.
  3. 3.Inspect repeated and empty values, then copy and validate the result against the receiving API.

About Query String Parser

Query String Parser converts URL query data to JSON and converts a deliberately limited JSON shape back to a query string. In query-to-JSON mode, paste text with or without a leading question mark. The tool decodes percent escapes, treats plus signs as spaces, preserves empty values, and retains repeated parameter names as arrays in encounter order. In JSON-to-query mode, strings, finite JSON numbers, booleans, null, and arrays of those scalar values become encoded parameters.

The behavior follows the browser URLSearchParams implementation and the WHATWG application/x-www-form-urlencoded rules. A space serializes as plus, while a literal plus is percent encoded. Reserved characters such as ampersand and equals are encoded when they belong to a value rather than acting as separators. Unicode is converted through UTF-8 percent encoding. The output is a query component without a leading question mark, because callers may need to place it into a URL, request body, log fixture, or test independently.

Repeated names are not silently overwritten. The query tag=a&tag=b becomes a JSON array containing a and b. A single occurrence remains a string, so the result preserves the distinction visible in the source. This policy is useful but not a universal server convention: frameworks may keep the first value, keep the last, always create arrays, split commas, or apply schema-specific coercion. Confirm the contract of the receiving application before using generated data.

The JSON direction rejects nested objects and nested arrays. Query strings do not have one standard representation for nested data; bracket notation, dotted names, indexed names, and embedded JSON are competing conventions. Guessing would create output that looks valid but means something different to another parser. Empty arrays are omitted because they contain no value to append. Null becomes an empty value, while JSON numbers and booleans become their textual forms.

Parsing does not validate a complete URL, hostname, path, fragment, signature, or authorization policy. If a full URL is pasted, its path can be mistaken for part of a parameter name. Use the separate URL Parser first when you need URL component validation. Sorting or rebuilding query parameters can break signed URLs and cache keys because order, duplicate occurrence, percent-escape spelling, and plus-versus-%20 choices may be covered by a signature. Preserve the original bytes when canonicalization rules are not explicitly known.

A 200,000-character limit bounds work in the current tab. Conversion and clipboard writes stay in the browser; no query text, JSON, token, identifier, or URL is uploaded. Even so, query strings frequently contain session identifiers, email addresses, search terms, and tracking values. Avoid placing secrets in URLs because browsers, history, analytics, proxies, referrers, and server logs can retain them independently of this tool. Redact sensitive data before sharing output.

Eight external fixtures lock single pairs, duplicate names, plus-to-space decoding, UTF-8 text, missing equals signs, empty values, reserved characters, and the optional leading question mark. Additional tests cover scalar serialization, arrays, null, nested-data rejection, and round trips. The reference does not perform type inference: the text 2 remains the JSON string "2" when parsed from a query because the wire format carries text, not a numeric type declaration.

For reliable use, choose the direction, paste only the query component or a flat JSON object, convert, inspect repeated and empty values, then copy the result. Validate the exact expectations of the server or API before sending it. When a protocol specifies a canonical parameter order or signature algorithm, use that protocol's official encoder instead of a general-purpose converter.

Methodology & sources

Uses the browser-compatible URLSearchParams model, preserves duplicate names as ordered arrays, performs no type inference, accepts only flat JSON scalar values or scalar arrays, and bounds input at 200,000 characters. Eight WHATWG/MDN fixtures anchor decoding behavior.

Frequently asked questions

Why do repeated query keys become arrays?
Arrays preserve every occurrence in encounter order instead of silently discarding earlier values. Your server may use a different convention, so verify its contract.
Why are nested JSON objects rejected?
Query strings have no universal nested-object syntax. Brackets, dots, indices, and embedded JSON are incompatible conventions, so the tool does not guess.
Does this safely edit signed URLs?
No. Reordering or re-encoding parameters can invalidate signatures and cache keys. Preserve the original serialized bytes unless the signing protocol defines canonicalization.

Developer Tools guides

View all