JSON to CSV

Convert JSON data to CSV format for spreadsheets

By

Developer tools

Runs in your browser. No signup required.

An array of objects, flattened with dots

The input must be a JSON array. A single object, or an array of strings, is rejected with “JSON must be an array of objects.” Each object is flattened: nested objects become dotted keys, and arrays become one cell containing JSON text. Keys are gathered in the order they are first seen across the rows. Missing keys become empty cells. Values that contain a comma, a quote, or a line break are quoted, and quotes inside a value are doubled.

The sample Alice/Bob array becomes a header name,age and two rows. Add a nested object such as {"name":"Ada","address":{"city":"London"}} and the header gains address.city. That is the spreadsheet shape. It is not a reversible encoding of every JSON type.

Moving API records into a sheet

Paste a list of records or choose a local .json file. The base name on the download starts as data. Open the CSV in a spreadsheet and check that dotted headers landed as columns you actually want. If a column is a JSON array in one cell, the sheet will not split it further. Parse that column later, or reshape the JSON before you convert.

The CSV to JSON page does the reverse for a flat table, and it will not rebuild nested objects from dotted headers by itself. The JSON formatter is the place to pretty-print before you convert, when the payload is one line and you need to see it. Conversion stays in the browser.

Types, order, and size

Numbers and booleans pass through String(), so true becomes the letters true and 30 becomes 30. null and undefined both become an empty cell, because the converter uses ?? before stringifying. A column that is sometimes null and sometimes missing will look the same in the sheet. Very large integers can already have been rounded by JSON.parse before any of that runs.

A file that is not JSON shows the parser error and no download. The page does not repair precision and does not upload the text. Clear the box when the records include personal data. The file you download is the copy to keep.

Objects flatten, then one header is built

The text must be a JSON array of objects. Anything else stops with the message that JSON must be an array of objects. Nested objects become dotted keys. Arrays become a JSON text cell. One object named Ada, with a nested city of Oslo and a tags array of a and b, writes the header name,meta.city,tags. The data row is Ada, Oslo, and a third cell that holds the JSON array. That cell is wrapped in quotes and every quote inside it is doubled, because the array text contains both a comma and quotes.

Headers are the union of keys in the order they are first seen. A later object can add a column. A missing key becomes an empty cell. The starter array of Alice age 30 and Bob age 25 becomes name,age then Alice,30 then Bob,25. Numbers stay digits. They are not quoted unless the string form contains a comma, a quote, or a newline.

A second object that adds a column

Two objects, {"name":"Ada"} and {"name":"Bea","role":"editor"}, produce the header name,role and the lines Ada, then Bea,editor. Ada’s missing role is an empty field, so the line is Ada, with a trailing comma. That trailing comma is the empty cell. It is not a broken row.

A value that contains a comma is quoted. The name Ada, Jr. becomes "Ada, Jr." in the cell. A quote in a value is doubled. The download name follows the uploaded file, with .json removed and .csv added. Pasted text downloads as data.csv.

What stays in the browser

Parse and flatten run on this page. The file you upload is read locally. Nothing is posted to a server. Clear the boxes when the JSON contains customer data. A refresh drops both sides.

The CSV to JSON page is the reverse direction, and its header split is simpler than this writer. A round trip can change quoting and will not restore a nested object that this page already flattened into dotted keys. The JSON formatter only indents. It does not build a table.

Quoting rules on a single cell

A value is quoted only when its string form contains a comma, a double quote, or a newline. Ada, Jr. becomes a quoted cell. A plain name Ada is not quoted. A quote character inside a value is written twice, then the cell is quoted. Nested objects never become extra rows. They become dotted columns, and an array becomes one cell of JSON text rather than one column per element.

The starter Alice and Bob rows are name,age then Alice,30 then Bob,25, with a newline between lines and no trailing comma on those rows. A missing later field does add a comma so the columns still line up. Convert replaces the CSV box. A parse error clears it, so an old table does not sit under a new error.

How to convert JSON to CSV with UtilGenie

Turn JSON into a spreadsheet-ready CSV free in your browser.

  1. 1

    Open the JSON to CSV page.

  2. 2

    Paste a JSON array of objects, or click Upload JSON to load a .json file.

  3. 3

    Click Convert to CSV.

  4. 4

    Read the CSV preview. Nested objects become dotted column names.

  5. 5

    Click Download or Copy CSV.

FAQ

How do I convert JSON to CSV online?

Paste a JSON array into JSON Input, or click Upload JSON, then click Convert to CSV and Download. It runs in the browser without signup.

What JSON shape works best for CSV?

An array of flat objects (same keys per row) converts cleanly to columns. Deeply nested JSON may need flattening first or may produce partial columns—check the preview before download.

Can I convert CSV back to JSON?

Use the separate CSV to JSON tool for the reverse direction. This page only turns JSON into CSV.

Is JSON to CSV the same as a JSON formatter?

No. A JSON formatter pretty-prints and validates JSON. JSON to CSV turns that structure into CSV rows. Use the JSON formatter when you only need to read or tidy the JSON.

Do you upload my JSON to a server?

UtilGenie’s converter is browser-based so your JSON isn’t uploaded to UtilGenie servers for the conversion. Still avoid pasting highly sensitive production data into any public page.

What does a nested city become?

A dotted key. An object with meta.city Oslo and tags ["a","b"] contributes the columns name, meta.city, and tags. The tags cell is the JSON text of the array, quoted because it contains commas.

What if the second object has an extra key?

That key is added to the header. Earlier rows get an empty cell, written as a trailing comma when the extra key is last.

Which JSON is refused?

Anything that is not an array of objects, including a single object. Invalid JSON shows the parser message and clears the CSV.