Skip to main content

Structured Data

CSV and JSON Converter

Turn CSV rows into JSON objects, or JSON back into CSV, in your browser. Handles quoted commas and line breaks, keeps leading zeros, and flattens nested JSON.

Tool workspace

Your input stays in this browser.

Add the required input to continue.

Needs input

You can run the tool again after any change.

Options

Your result appears here

Turn CSV rows into JSON objects, or JSON back into CSV, in your browser. Handles quoted commas and line breaks, keeps leading zeros, and flattens nested JSON.

This tool runs open-source code from CyberChef by GCHQ (Apache License 2.0). See open-source credits.

CSV conversion parses quoted delimiters, doubled quotes, and quoted line breaks. JSON conversion flattens nested records into columns.

CSV to JSON returns objects or arrays. JSON to CSV quotes special cells and uses CRLF rows by default.

  • Turn a spreadsheet export into JSON fixtures without losing leading zeros in IDs.

Sources: RFC 4180: CSV records, headers, and quoting; RFC 8259: JSON numbers and object names

Keep a leading-zero identifier during conversion

Input: id,city 007,"Paris, FR"

Settings: Cell delimiters: , and Row delimiters: \r\n, Format: Array of dictionaries (the defaults)

Result: [ { "id": "007", "city": "Paris, FR" } ]

The leading zeros in 007 survive because every cell stays a string. The quoted comma stays inside the city value.

Choose the conversion direction and separators

  1. Select CSV to JSON or JSON to CSV.
  2. Use Array of dictionaries for unique headers and equal row widths.
  3. Use Array of arrays for headerless or uneven rows.
  4. Set Cell delimiters to match the data, then inspect the converted rows.

Cell types and flattened paths

  • Quote whole CSV cells; spaces before an opening quote cause an error.
  • JSON numeric parsing can round large identifiers. Store such identifiers as strings.
  • Flattened arrays and objects do not rebuild automatically during reverse conversion.