Skip to content
Tools on Deck

Convert JSON to CSV and CSV Back to JSON

4 min read

To convert JSON to CSV, turn each JSON item into a row and each object key into a column. Ordinary input is an array of objects, but one object and arrays of primitive values also work. Nested objects can become dotted column names, while arrays are stored as JSON strings inside individual cells.

The JSON to CSV converter also works in reverse. It offers comma, semicolon, and tab delimiters, optional header output, automatic CSV delimiter detection, and a Convert numbers and booleans switch. Conversion and file reading remain in your browser.

JSON shapes accepted for CSV conversion

An array of objects produces the familiar table shape: every object is one row, and its keys contribute columns. A single object becomes one row. An array of primitive values such as strings, numbers, booleans, or nulls becomes rows under a column named value.

Columns are not limited to the keys in the first object. The converter visits every row and adds keys in first-seen order, so a property introduced later is retained. When a row lacks a property found elsewhere, its CSV cell is empty.

CSV is rectangular, while JSON can represent irregular and deeply nested structures. Conversion therefore needs representation rules rather than a perfect one-to-one mapping. Review the preview and downloaded data before treating an empty cell, null, missing property, or serialized structure as equivalent in your downstream system.

Flatten nested objects and preserve arrays

With Flatten nested objects enabled, an object path becomes a dotted key. For example, customer.address.city can be a column heading for a nested city value. The flattening continues through nested objects, producing a table that spreadsheets can display as ordinary columns.

Arrays do not expand into repeated columns or extra rows. They are serialized as JSON strings, preserving brackets, order, strings, and other represented values inside one CSV cell. A value such as ["red","blue"] therefore remains a structured text value that can be parsed later.

When flattening is off, nested objects are also serialized into JSON text instead of being converted to dotted paths. Choose based on how the receiving spreadsheet, database import, or script expects nested data.

How to convert JSON to CSV with Tools on Deck

The conversion updates after a short typing delay. You can paste source text, use Sample, or select Open file for .json, .csv, or text input appropriate to the current direction.

  1. Open the converter and select JSON → CSV.
  2. Paste a JSON object, an array of objects, or an array of primitive values into Input · JSON.
  3. Choose Comma, Semicolon, or Tab under Delimiter.
  4. Turn Flatten nested objects and Include header row on or off for the target import format.
  5. Read any Conversion error and inspect the preview, which shows up to the first 50 records.
  6. Copy Output · CSV or download data.csv, then open or import it in Excel or Google Sheets.

Comma, semicolon, and tab delimiters

Comma is the conventional CSV delimiter, but it is not universal. Some Excel installations in locales that use a comma as the decimal separator expect semicolon-delimited text, which avoids ambiguity between decimal commas and column separators. Choose Semicolon when the intended Excel environment or export specification requires it.

Tab creates tab-separated values, often called TSV even when the downloaded filename remains data.csv. Tabs can be convenient when textual values contain many commas, though correct CSV quoting already handles delimiters inside cells. The receiving program must be told or able to detect the chosen separator.

For CSV → JSON, Delimiter defaults to Auto-detect and the parser examines the input. You can override it with Comma, Semicolon, or Tab if detection chooses incorrectly or you already know the format.

CSV quoting rules for commas, quotes, and newlines

A CSV field containing its delimiter, a quotation mark, or an embedded newline must be escaped correctly. The converter uses Papa Parse to generate the CSV. A protected field is surrounded by double quotes, and a double quote inside that field is represented by two double quotes.

For example, the value Ada, L needs quoting in comma-delimited output because its comma is data rather than a column boundary. A multiline note also remains one cell when quoted. Do not remove those quotes merely because they are visible in a text editor.

Include header row is on by default. Turn it off only when the destination expects data rows without column names. The on-page preview still uses the detected columns so you can inspect the structure.

Convert CSV to JSON and handle value types

Switch to CSV → JSON to parse a header row and create an array of objects. The first row supplies property names. Empty lines are skipped, and parser problems are reported with row information when available. Output uses either 2 spaces or 4 spaces according to the Indent control.

Convert numbers and booleans is enabled by default. It turns recognizable numeric and boolean cells into JSON numbers and booleans rather than leaving every value as a string. Disable it when identifiers with meaningful formatting, such as some leading-zero codes, must remain textual or when your schema expects strings.

After conversion, use the JSON formatter if you need to validate, sort keys, minify, or reformat the result. Type inference is convenient, but you should still review identifiers, dates, empty cells, and values that resemble numbers.

Quick answers about JSON and CSV

Use an array of objects for ordinary rows, one object for a single row, or an array of primitives for a value column. Flattening turns nested object paths into dotted headings, while arrays remain JSON strings in cells.

Excel may expect semicolons in locales that use decimal commas; Google Sheets can import comma, semicolon, or tab data when you choose the separator. Keep CSV quoting intact so delimiters, double quotes, and newlines remain part of the correct cell.

Try it free