How to Convert JSON to CSV: Examples, Nested Data and Common Errors

A practical JSON-to-CSV walkthrough with a reproducible example, output checks, and limits for nested records.

CSV is a flat table: each row is one record and each column is one field. JSON can also contain nested objects, lists, and mixed shapes, so the first task is deciding what one spreadsheet row should represent. The ToolVero converter accepts a JSON array of objects; it does not infer a relational model or expand nested data into extra rows.

Start with a flat array of records

This small input has two records. The second record has a different set of fields, and one text value contains a comma and quotation marks:

[
  {"order_id":"0007","customer":"Ari, Inc.","paid":true,"note":"He said \"ship\""},
  {"order_id":"0008","customer":"Bo","paid":false,"extra":null}
]

The converter makes one column for every key it encounters, in first-seen order. It quotes every cell and doubles an embedded quote, producing:

"order_id","customer","paid","note","extra"
"0007","Ari, Inc.","true","He said ""ship""",""
"0008","Bo","false","",""

That output follows common CSV escaping rules: commas and double quotes inside a field are safe because the field is surrounded by quotes, and an internal quote is doubled. See the RFC 4180 description of CSV for the widely used format conventions.

What happens to missing, null, and non-string values?

  • Missing key: the row gets an empty cell under that column.
  • null: it also becomes an empty cell. The CSV cannot tell those cases apart after conversion.
  • Boolean and number: they become text such as true, false, or 30.
  • Nested object: it becomes the generic string [object Object]; its child properties are not flattened into columns.
  • Array value: JavaScript string conversion joins its items with commas inside the quoted cell. This is not the same as creating a separate row for each item.

Important: the example preserves 0007 in the CSV text. Spreadsheet software may still interpret that field as a number and remove leading zeroes when opening the file. Import the column as text when the zeros are meaningful. Microsoft explains the import options in its guide to keeping leading zeros and large numbers.

Prepare nested JSON before converting

Suppose each order contains a customer object and a list of products. Decide which level should define a row. For an order summary, make one row per order and extract only fields such as order ID, customer name, and total. For product analysis, make one row per product and repeat the order ID on each product row. If you need to preserve all relationships, use separate tables keyed by an ID instead of forcing everything into one CSV.

Do not simply stringify nested data and assume a spreadsheet can analyze it. Review the source structure first, then reshape it into a flat array of records. The converter can process that simpler array.

Convert and check the result

  1. Paste a JSON array whose top-level value is [ ... ] and whose elements are objects such as {"id":1}.
  2. Convert, then confirm the header contains the columns you expect and that each row represents one record.
  3. Check records with missing keys, empty strings, commas, quotation marks, leading zeroes, and non-ASCII text.
  4. Import into your spreadsheet using its text/CSV import flow if column types matter. Choose the delimiter and text handling deliberately instead of trusting automatic type detection.
  5. Compare the number of output data rows with the number of input objects, and keep the original JSON until the spreadsheet is verified.

Common errors and what to do

What you seeLikely causeNext check
Parsing errorInvalid JSON, such as a trailing comma or single-quoted keyValidate the JSON syntax; JSON strings and keys use double quotes.
“Enter a JSON array of objects”The top level is an object, scalar, or array containing a nested arrayWrap records in one array and make each array element an object.
Columns contain [object Object]A field contains a nested objectFlatten the fields before converting, or export a separate table.
Leading zeros disappeared in ExcelThe spreadsheet inferred a numeric typeImport the column as text and verify the values before saving.

When this converter is a good fit

Use it for a manageable array of mostly flat records when one object should become one CSV row. If your data is deeply nested, contains arrays that need separate rows, or requires exact preservation of null versus missing values, reshape it with a purpose-built data workflow first. Avoid pasting secrets or confidential records into online tools; check the site’s privacy information before processing sensitive data.

Frequently asked questions

Can I convert a single JSON object?

The current ToolVero converter expects an array of objects. Put the object inside an array, for example [{"id":1}], if it represents one row.

Does it flatten nested JSON?

No. Nested objects are converted to a generic string and arrays are stringified inside one cell. Flatten or normalize the data before using the converter.

Why are some CSV fields blank?

The converter writes blank cells for both missing keys and values set to null. Keep the original JSON if you need to distinguish them later.

Try the related tool

Browse all practical guides