Dev · 108 tools · nothing uploads

Query string <-> JSON

Convert a URL query string to a JSON object or back, with repeated keys folding into an array. Runs on your device, nothing is uploaded.

Options

live

Query string <-> JSON reads a URL query string into a JSON object, folding a repeated key into an array of every value seen, or runs the reverse with URLSearchParams. Converting to a query string refuses a top-level array or scalar. An array on the JSON side becomes a key repeated once per element, never one list value.

Questions

How are repeated keys handled?

They fold into a JSON array of every value seen for that key, in the order they appeared in the query string.

What does json-to-qs require?

A JSON object at the top level; an array or scalar there is refused.

How is an array value on the JSON side encoded?

As one repeated key, appended once per array element, rather than a single encoded list value.

Does it strip a leading ? or #?

Yes, either is stripped before parsing. A pasted URL fragment therefore works as it is, without trimming it first.

What handles the encoding and decoding?

The browser's own URLSearchParams, the same parser a page uses, so plus signs and percent escapes follow the web rules.

Related Dev tools

n→nJSON format / validateParse, validate and pretty-print JSON, with a clear parse-error message if it is broken.Runs on each file you dropn→nJSON sort / minify / escapeSort object keys, minify to one line, or escape/unescape JSON for embedding inside another string.Runs on each file you dropn→nJSONPath queryQuery JSON with a JSONPath expression: dot/bracket access, wildcards (*), recursive descent (..). No filter expressions (?()) or slices; those need a full JSONPath engine this build does not have.Runs on each file you dropn→nJSON Schema generatorInfer a draft-07 JSON Schema from an example JSON document. Every observed key is marked required, arrays are typed to accept every observed element.Runs on each file you dropn→nJSON to TypeScriptJSON to TypeScript. Infers types from an example JSON document. Nested objects become named types by their key; mixed-type arrays fall back to a broad/any type.Runs on each file you dropn→nJSON to GoJSON to Go. Infers types from an example JSON document. Nested objects become named types by their key; mixed-type arrays fall back to a broad/any type.Runs on each file you dropn→nJSON to RustJSON to Rust. Infers types from an example JSON document. Nested objects become named types by their key; mixed-type arrays fall back to a broad/any type.Runs on each file you dropn→nJSON ↔ CSVConvert a flat JSON array of objects to CSV and back. CSV has no type system: JSON->CSV renders numbers/booleans/null as text and CSV->JSON always comes back as strings. A nested object or array field is refused by name rather than silently flattened. CSV parsing is fully quote-aware, embedded newlines included; a file with an unterminated quote is refused rather than guessed at.Runs on each file you drop