JSON to Query String & Query to JSON

Paste flat JSON, a query string, or a full URL on the left, then Convert. Direction is detected automatically; results and status appear on the right.

Flat JSON and the query component

HTTP GET requests often carry data in the query string: the substring after ? in a URL, formatted as application/x-www-form-urlencoded pairs (name=value joined by &). That layer is inherently flat—no nested objects—unlike JSON, which can nest maps and arrays.

This page converts between a single-level JSON object and that query representation (or extracts query from a pasted URL). It is a structural view of the same data, not a substitute for full URI design, OpenAPI parameter docs, or server-side validation rules.

Query strings — background

Where query strings live in a URL

scheme://host/path?query#fragment — only the query part is key=value pairs. The path identifies the resource; the query refines the request (filters, pagination, tokens). Fragments (#…) are not sent to the server in typical browser navigation. Parsers therefore strip ?… and stop at # when turning a full URL into parameters.

Encoding: +, %XX, and reserved characters

Spaces may appear as + or %20; non-ASCII and reserved characters (&, =, ?, /) are percent-encoded. Converting JSON to a query string uses URLSearchParams-style encoding on values. Converting query to JSON decodes % sequences and treats + as space, matching common web platform behavior—not every legacy server agrees on empty values or semicolon separators.

Duplicate keys and arrays

Repeated keys (tag=a&tag=b) express multi-valued parameters. Many frameworks expose them as arrays; a single occurrence stays a scalar. JSON to query reverses the pattern by emitting repeated keys for array values. There is no universal standard for nested structures in query strings—objects inside objects belong in JSON bodies or dedicated encodings (e.g. bracket notation), not implicit nesting here.

Scalar typing on parse

Query values arrive as text. Heuristics may map unquoted tokens to numbers or true/false/null when they look unambiguous; everything else remains a string. IDs with leading zeros, large integers beyond safe JSON number range, and locale-specific decimals are common reasons to keep values as strings in application code.

Where conversion fits

Client-side request assembly

A params object in JavaScript often becomes searchParams for fetch; seeing the serialized query helps compare with network traces and backend logs.

Debugging shared links

Pasting a bookmarked URL yields a JSON snapshot of parameters for tickets, tests, or diffing environment-specific links—without retyping each key.

Frequently asked questions

What is the difference between query string and JSON body?
GET queries ride in the URL and are length-limited and logged more often; JSON bodies (POST/PUT) carry structured data including nesting. Converting a flat object to or from a query string does not move data across those HTTP semantics—it only reshapes flat key-value data.
Why only flat JSON objects?
Standard query encoding has no single nested-object model. Nested maps must be flattened (JSON flatten), encoded with a convention your API documents, or sent as JSON in the body instead.
How are duplicate query parameters represented in JSON?
Multiple values for one name become a JSON array; a single value stays a scalar. That mirrors URLSearchParams.getAll and many server frameworks.
Does JSON to query string add a leading ?
Output is the raw query segment (key=value&…). You prepend ? when attaching to a path, or & when appending to an URL that already has parameters.
How does parsing decide number versus string?
Integer and simple decimal patterns map to number; true, false, and null literals map accordingly; decoded text otherwise stays string. When in doubt, compare with the raw query text—ambiguous tokens stay strings.
Can I convert nested JSON or array-only roots?
Root must be a plain object with scalar or array values; nested objects trigger an error. Arrays at the root are not query objects—use an object wrapper or flatten first.
JSON vs query for API design—what should I use?
Use query for filters, pagination, and idempotent reads; use JSON bodies for creates and complex payloads. OpenAPI describes both; this tool helps inspect flat parameter sets, not replace schema design.