Home › Developer Tools › Query String to JSON

Query String to JSON

Paste a full URL or just the query string and get clean JSON instantly. Bracket notation like user[name]=Ann, arrays like tags[]=a&tags[]=b, repeated keys and percent-encoding are all handled, and the converter works the other way too: JSON in, query string out.

Last updated:

JSON

      
    
    Parameters
    Advertisement
    Advertisement

    How to use the Query String to JSON

    1. Pick the direction: Query string to JSON, or JSON to query string.
    2. Paste your input: a whole URL works, the part after ? is used and the #fragment is ignored.
    3. Choose the options: how to treat repeated keys, dot notation, + as space and type detection.
    4. Read the result on the right; it updates as you type. The table lists every parameter decoded.
    5. Copy or download the JSON or the query string.

    Query string syntax this converter understands

    Query stringJSON result
    name=Ann&age=31{"name": "Ann", "age": "31"}
    user[name]=Ann&user[city]=Oslo{"user": {"name": "Ann", "city": "Oslo"}}
    tags[]=a&tags[]=b{"tags": ["a", "b"]}
    items[0][id]=7&items[1][id]=9{"items": [{"id": "7"}, {"id": "9"}]}
    color=red&color=blue{"color": ["red", "blue"]} (or first/last value)
    a.b=1 (dot notation on){"a": {"b": "1"}}
    q=caf%C3%A9+au+lait{"q": "café au lait"}
    debug (no =){"debug": ""}

    Encoding rules worth knowing

    • Percent-encoding: reserved characters are written as % plus two hex digits of their UTF-8 bytes, so é becomes %C3%A9, & becomes %26 and = becomes %3D.
    • Spaces: + in HTML form encoding, %20 in generic URLs. A literal plus sign must be sent as %2B.
    • Brackets: [ and ] are technically reserved and are often sent as %5B and %5D; servers decode them before parsing nested keys, and so does this tool.
    • Everything is a string: a query string has no types. page=2 is the text "2" until your code converts it.
    • Order is preserved in the JSON output exactly as the parameters appear in the URL.

    Parsing query strings in code

    JavaScript: Object.fromEntries(new URLSearchParams(location.search)) gives a flat object (last value wins, no nesting). For nested brackets use the qs library: qs.parse(str). PHP fills $_GET with the same bracket rules automatically, Python's urllib.parse.parse_qs returns a dict of lists, and Ruby on Rails exposes nested params.

    Frequently asked questions

    How are nested parameters like user[address][city] converted?

    Each bracket segment becomes one level of nesting, so user[address][city]=Paris becomes {"user": {"address": {"city": "Paris"}}}. Empty brackets (tags[]=a) append to an array, and numeric brackets (items[0]=x) set an array position. This is the convention used by PHP, Ruby on Rails and the Node.js qs library.

    What happens with repeated keys without brackets?

    The URL standard allows the same key several times (color=red&color=blue). By default this tool collects them into an array, like most server frameworks. You can switch to keep only the first or the last value, which matches what some frameworks and URLSearchParams.get() return.

    Why is + converted to a space?

    In the application/x-www-form-urlencoded format used by HTML forms and query strings, a space is encoded as +, and a literal plus sign as %2B. If your string comes from a source that encodes spaces only as %20 and uses + literally, turn off the + as space option.

    Are values converted to numbers or booleans?

    Not by default, because every value in a query string is text and "007" or "1e3" would otherwise change meaning. Enable Detect types to convert plain numbers, true, false and null. Leading zeros and very large integers are kept as strings.

    Which array format should I use for JSON to query string?

    Use brackets (a[]=1&a[]=2) for PHP, Rails and Express with qs; indices (a[0]=1&a[1]=2) when order or nested objects in arrays matter; repeat (a=1&a=2) for Python, Go, Java Spring and URLSearchParams; and comma (a=1,2) only when your API documents it.

    Is my data sent to a server?

    No. Parsing and encoding happen entirely in JavaScript in your browser, so URLs containing tokens or personal data never leave your device.

    Are all the tools on FreeToolCabin tested for quality and accuracy?

    Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

    Related tools

    URL ParserBreak a URL into its parts and edit query string parameters with a live rebuild.URL Encoder DecoderPercent-encode or decode URLs, query strings and form data.JSON FormatterBeautify, minify and validate JSON, with a collapsible tree view.cURL to Code ConverterConvert curl commands to JavaScript fetch, Axios, Python requests, Node.js, PHP and Go code.JavaScript Object to JSONTurn JS object literals and Python dicts into valid JSON: quotes keys, fixes commas and values.JSON to Excel ConverterTurn JSON into a styled .xlsx spreadsheet; nested arrays become their own linked sheets.JSON to CSVConvert JSON data to CSV for spreadsheets.CSV to JSONConvert CSV data to JSON with live preview.Excel to CSVConvert XLSX spreadsheets to CSV.CSV ViewerOpen a CSV or TSV file as a sortable, filterable table.Excel Viewer (XLSX / XLS)Open XLSX, XLS and ODS spreadsheets in your browser without Excel.Line Ending ConverterConvert text and files between CRLF, LF and CR line endings.Markdown to HTMLConvert Markdown to clean HTML with a live editor.XML to JSONConvert XML to JSON with validation.Text Encoding ConverterDetect and convert text file encodings like UTF-8, UTF-16 and Latin-1.JSON ViewerExplore JSON as a collapsible tree, search keys and values and copy any node's path.TTF to WOFF2 ConverterConvert TTF and OTF fonts to WOFF2 or WOFF and get a ready @font-face CSS snippet.Chmod CalculatorConvert Linux file permissions between checkboxes, octal (755) and symbolic (rwxr-xr-x) notation.JSON to TypeScriptGenerate TypeScript interfaces or types from JSON, with nested types and optional fields.Morse Code TranslatorTranslate text to Morse code and back, then play it as sound or a blinking light, or save a WAV.HTML Table GeneratorBuild HTML tables in an editable grid with styles, header rows, CSV import and live preview.Hex to Text ConverterConvert hex to text and text to hex with UTF-8 support and space, 0x, \x or comma formats.JSON to XML ConverterConvert JSON to well-formed XML with attributes, arrays and pretty print.JSON to YAML ConverterConvert JSON to clean YAML as you type, with indent, quoting and sort options.YAML to JSON ConverterConvert YAML to pretty or minified JSON, with errors pinned to the exact line.HTML to Markdown ConverterTurn HTML or pasted rich text into clean Markdown with tables and live preview.Markdown Table GeneratorBuild Markdown tables in a grid or paste from Excel/CSV, with alignment and preview.JSON ValidatorCheck JSON with the exact line and column of each error, fix tips and one-click auto-fix.Image to Base64Convert images to Base64 data URIs, CSS backgrounds and HTML img tags in your browser.Base64 to ImagePaste a Base64 string or data URI to preview, identify and download the image.JSON CompareCompare two JSON documents and see every added, removed and changed path.Hex to DecimalConvert hex to decimal instantly with steps and signed mode.Decimal to HexConvert decimal to hex instantly with steps and signed mode.Binary to DecimalConvert binary to decimal instantly with steps and signed mode.Decimal to BinaryConvert decimal to binary instantly with steps and signed mode.Two's Complement CalculatorDecimal to two's complement binary and back for 4-64 bits, with invert-and-add-1 steps.XML to CSV ConverterConvert XML to CSV: detects repeating records, flattens nested data, pick your columns.CSV to XML ConverterConvert CSV to well-formed XML with custom root and row names, escaping and pretty print.HTML Table to CSVExtract any table from HTML or page source to CSV, TSV or JSON, with colspan and rowspan handled.IEEE 754 Floating Point ConverterConvert decimals to 32/64-bit IEEE 754 floats: toggle bits, see hex, exact value and rounding error.INI to JSON ConverterConvert INI and CFG files to JSON and JSON back to INI, with sections, arrays and types.IP Address ConverterConvert IPv4 to decimal, hex, binary, octal and back, with class and private/public check.ISBN Converter & ValidatorConvert ISBN-10 to ISBN-13 and back, validate check digits and hyphenate, one or in bulk.JSON Flatten / UnflattenFlatten nested JSON to dot or bracket path keys, or unflatten flat keys back to nested JSON.JSON to Dart ClassTurn JSON into Dart model classes with fromJson, toJson, null safety and nested classes.JSON to Java ClassTurn JSON into Java POJOs or records with Lombok, getters/setters and Jackson or Gson annotations.JSON to Kotlin Data ClassTurn JSON into Kotlin data classes for kotlinx.serialization, Gson, Moshi or Jackson.JSON to Markdown TableTurn a JSON array of objects into a GitHub Markdown table with column picker and alignment.JSON to PHP ArrayConvert JSON to PHP array code (short [] or array()) and PHP arrays back to JSON.JSON to Rust StructTurn JSON into Rust structs with serde derives, rename attributes, Option and Vec types.JSON to SQL ConverterConvert a JSON array of objects to CREATE TABLE and INSERT statements for MySQL, Postgres, SQLite.JSON to Swift StructTurn JSON into Swift Codable structs with CodingKeys, optionals and nested types.JSON to TOML ConverterConvert JSON to clean TOML with tables, arrays of tables, inline tables and dates.JSONL to JSON ConverterConvert JSON Lines / NDJSON to a JSON array and back, with line-level error reports.Properties to YAML ConverterConvert Java .properties to nested YAML (application.yml) and YAML back to properties.PX to EM ConverterConvert pixels to em using the parent font size, and em back to px, with conversion tables.REM to PX ConverterConvert CSS rem values to pixels for any root font size, with a quick 0.25–6rem table.SQL to JSON ConverterConvert SQL INSERT statements and dumps into a JSON array of row objects, with CSV export.TSV to CSV ConverterConvert TSV to CSV and back, or between tab, comma, semicolon and pipe, with correct quoting.TypeScript to JavaScriptConvert TypeScript or TSX to clean JavaScript instantly: strip types, keep or compile JSX.XML to YAML ConverterConvert XML to clean YAML with attributes, text nodes, lists and exact error lines.YAML to XML ConverterConvert YAML to pretty, well-formed XML with custom root, attributes and array item tags.Boolean Algebra SimplifierSimplify boolean expressions or minterm lists to minimal SOP and POS with Quine-McCluskey steps.Compare Excel FilesCompare two Excel spreadsheets cell by cell, highlight changes and export a diff report.CSV CleanerClean messy CSV in one click: trim spaces, drop empty rows and columns, fix headers, dedupe.CSV VLOOKUP ToolJoin two CSV or Excel files on a key column like VLOOKUP, with left, inner and full joins.Remove Duplicates in ExcelFind and remove or highlight duplicate rows in XLSX or CSV files by the columns you choose.GeoJSON ViewerView GeoJSON on a map, inspect and edit properties, validate against RFC 7946 and export.
    See all 129 Data & File Format Converters →