toolgarden.xyz
中文

JSON → CSV

Free online tool to export a JSON / JSONC / JSON5 array as a CSV file

Input JSON / JSONC / JSON5 Array

CSV Output

CSV content will appear here

About this tool

CSV is a two-dimensional table while JSON can be nested arbitrarily, so an array of objects is the only shape that maps directly to useful rows and columns. The converter gathers every first-level key as a header and writes each array item as one row, leaving missing fields blank.

Commas, quotes, and line breaks are quoted according to CSV rules, with inner quotes doubled. Nested objects and arrays are not expanded into related tables; they become string values unless the JSON is flattened first.

How to use it

  1. Prepare an object array

    The root value must be a non-empty array whose items are objects. Wrap a single object in an array first.

  2. Review columns and values

    Check whether rows share the same fields and how nested objects, arrays, and missing values will appear.

  3. Copy or download CSV

    Confirm the header order, export the file, then verify encoding and delimiters in the destination spreadsheet.

Input and output example

An array of objects becomes rows. The nested addr.city flattens into a column name and the missing field is left blank.

JSON array
[
  { "id": 1, "name": "A", "addr": { "city": "Berlin" } },
  { "id": 2, "name": "B" }
]
CSV
id,name,addr.city
1,A,Berlin
2,B,

Supported range and limits

Input requirement
The top level should be an array of objects; a single object or a scalar has no rows to map
Header source
Inferred from element keys; when elements differ the union is used and missing cells are left blank
Nested fields
Nested objects are flattened into a.b.c column names, or serialised as text
Array fields
An array inside an element cannot occupy one column and is generally serialised to a string
Escaping
Fields containing commas, newlines or double quotes are quoted, with inner quotes doubled
Type loss
CSV is all text. Numbers, booleans and null may be re-inferred as something else by spreadsheet software

When you would use it

  • Exporting an API list

    Turn users, orders, or log records into CSV for filtering and aggregation in a spreadsheet.

  • Delivering data to non-developers

    Provide simple JSON as a widely readable table without asking the recipient to use developer tooling.

  • Handing API data to analysts

    Analysts work in spreadsheets for pivoting and filtering, and CSV is the most universally accepted handover format.

What to know before you start

  • Only first-level keys become columns. Nested structures are stringified rather than converted into a relational design.
  • CSV stores no number, date, or boolean types. Spreadsheet software may infer a type and alter the display.
  • Some regional spreadsheet settings expect semicolons. Choose UTF-8 and comma delimiter explicitly when importing.

Related concepts

header row
The first CSV row containing column names collected from first-level keys across the object array.
CSV quoting
A cell containing a comma, quote, or line break is wrapped in quotes and each inner quote is doubled.

Frequently asked questions

What kind of JSON can be turned into CSV?
An array of objects works best: each object becomes a row and the field names become the header. The tool collects the keys across all objects to build complete columns.
How are nested objects or arrays handled?
Nested fields are expanded sensibly or serialized into a cell; for deeply nested data, flatten it first with JSON Flatten before exporting.
Does converting upload my data?
No. JSON-to-CSV conversion runs locally in your browser and data is never uploaded.
Why did my nested field become one long string?
A spreadsheet has only rows and columns and cannot hold nesting. Deep objects flatten into a.b.c column names and arrays are generally serialised to strings. For deep nesting, run JSON Flatten first and then decide which columns to keep.
The CSV opens garbled; what now?
The export is UTF-8, while some Excel versions open text files in the local encoding. Use JSON to Excel to emit XLSX directly and sidestep it, or import via Data → From Text and specify UTF-8.