JSON to CSV Converter

Convert a JSON array of objects into CSV with a header row. Values that contain the delimiter, quotes or line breaks are quoted correctly, and nested objects are kept as JSON text.

Last updated
240 chars

About the JSON to CSV

Paste a JSON array such as [{"name": "Asha", "city": "Pune"}, {"name": "Ravi", "city": "Delhi"}] or load a .json file, then press Convert to CSV. Every key that appears in any of the objects becomes a column, in the order the keys first appear. Objects with different fields still line up: where an object lacks a key, its cell is left empty. A single object that is not inside an array is treated as one row.

Quoting follows RFC 4180, the rules spreadsheet programs expect. A value is wrapped in double quotes when it contains the delimiter, a double quote or a line break, and any double quote inside it is doubled, so He said "hi" becomes "He said ""hi""" and an address with a comma stays in one cell. Values with leading or trailing spaces are quoted too, so the spaces survive. null becomes an empty cell, numbers and true/false are written as they are, and nested objects or arrays are written as compact JSON text inside a single cell.

A typical use is turning an API response or a database export into something you can sort and filter in a spreadsheet. If the JSON came from somewhere you have not checked, run it through the JSON Formatter first to find syntax errors. To go back from a spreadsheet export to JSON, CSV to JSON reads CSV with the same quoting rules.

How to use the JSON to CSV

  1. 1

    Paste or load your JSON

    Paste an array of objects into the JSON Input box, or drop a .json file on the drop area (or click Browse Files).

  2. 2

    Pick the delimiter and header option

    Comma suits most programs; choose Semicolon if your Excel uses it as the list separator, or Tab for a TSV file. Untick "Include header row" if you only want data rows.

  3. 3

    Convert

    Press Convert to CSV. If the JSON is invalid or an item is not an object, the error message appears in the output box instead.

  4. 4

    Copy or save the CSV

    Use Copy to put the CSV on your clipboard, or Save to download it as data.csv.

What it can do

Columns from every object

The header is the union of all keys, not just the keys of the first object, so no field is dropped.

RFC 4180 quoting

Delimiters, double quotes, line breaks and edge spaces inside values are quoted and escaped so the CSV reads back correctly.

Nested data kept intact

Arrays and objects inside a record are written as JSON text in one cell, for example ["admin","editor"].

Four delimiters

Comma, semicolon, tab or pipe, with an optional header row.

Limitations

  • Nested objects are not flattened into separate columns such as address.city; each one stays as JSON text in a single cell.
  • The top level must be an array of objects or a single object. Arrays of arrays, or arrays of plain numbers or strings, are rejected with an error.
  • The CSV uses LF line endings and no byte-order mark. Excel on Windows may show accented letters or symbols such as ₹ incorrectly when you double-click the file; import it with Data > From Text/CSV and choose UTF-8 instead.
  • Numbers pass through JavaScript, so integers longer than about 15 to 16 digits lose precision. Put long IDs in quotes in the JSON to keep them exact.
  • The drop area takes one file of up to 50 MB.

Privacy

The JSON is parsed and converted by JavaScript in your browser, and files you choose are read locally; nothing is uploaded to FlexyPdf's servers.

Frequently asked questions

My objects do not all have the same keys. What happens?

Every key from every object becomes a column. If an object does not have a particular key, its cell in that column is left empty, so all rows still line up under the right headers.

How are nested objects and arrays handled?

They are converted to compact JSON text and placed in one cell. For example "tags": ["admin", "editor"] becomes the cell value ["admin","editor"], quoted in the CSV because it contains quotes and a comma.

Why do some values in the CSV have quotes around them?

CSV needs quotes around any value that contains the delimiter, a double quote or a line break; otherwise the value would split into several columns or rows. Quotes inside such a value are doubled. Spreadsheet programs remove these quotes when they open the file.

What does "Item 2 is not an object" mean?

Each element of the array must be an object such as {"a": 1}. The message names the first element that is a number, string, null or nested array so you can fix it.

Which delimiter should I choose for Excel?

Excel uses your system's list separator. In India, the US and the UK that is usually a comma; in many European locales it is a semicolon. If everything lands in column A, convert again with the other delimiter.

Ratings & Reviews

—
No ratings yet
5
0
4
0
3
0
2
0
1
0

Rate JSON to CSV

Help others by sharing your experience. Your rating is shown without your name.

0/600