Convert Nested JSON to CSV for Excel
Select an API response array, flatten object fields, choose columns, and export CSV with explicit array and spreadsheet settings.
By JSON Lab · Updated
CSV needs one row per record and one value per cell. JSON can contain nested objects and arrays, so an export needs a deliberate rule for each shape. Open JSON to CSV to follow this example.
Select the records in an API response
Paste this JSON, then enter data.items as the records path:
{
"data": {
"items": [
{"id":"001","name":"Ana","address":{"city":"Paris"},"tags":["new","paid"]},
{"id":"002","name":"Bo","address":{"city":"Rome"},"tags":["trial"],"note":null}
]
},
"total": 2
}
Leave the path empty when the input itself is the records array. A single root object can also become one row. An array of primitive values is not a table of records and is rejected.
The path follows object properties separated by dots. It does not accept array indexes, wildcards, or JSONPath expressions. If your response uses a literal property name containing a dot, extract or rename that wrapper in the source before using this path selector.
Flatten objects and decide how to represent arrays
Nested objects become dot-separated column names, such as address.city. The exporter collects fields across every record, in first-seen order. The example creates these columns:
id, name, address.city, tags, note
Arrays stay as JSON text by default. With comma as the delimiter, the exported CSV is:
"id","name","address.city","tags","note"
"001","Ana","Paris","[""new"",""paid""]",""
"002","Bo","Rome","[""trial""]",""
The exporter quotes every field. Doubled quotes inside a field are normal CSV escaping: they represent the quote characters inside the JSON array cell. Quoting empty fields also keeps a final empty record distinguishable from a blank line.
For a display-oriented export, select Join primitive values. With the default separator ** | **, the first tags cell becomes new | paid. This mode accepts strings, numbers, booleans, and null; it rejects arrays containing objects or nested arrays. Null inside a joined array becomes an empty segment.
Joining does not create extra rows and is not a reversible encoding. If one string already contains the separator, the CSV does not retain enough information to recover the original array. Use the default JSON-text mode when that distinction matters.
Check collisions, missing values, and columns
Missing fields and null values become empty cells. An empty object is kept as {}. If those distinctions are important downstream, add explicit status columns in your source data before exporting.
The input below is ambiguous after flattening:
[{"a.b":1,"a":{"b":2}}]
Both values would occupy a.b. The converter reports a collision instead of choosing one. It also checks for this conflict when the two shapes occur in different records.
After generating a table, deselect unneeded columns or move them into the order expected by the recipient. Inspect the preview, then regenerate whenever input or export settings change. Old results cannot be downloaded after such a change.
Import into Excel without changing identifiers
UTF-8 BOM is enabled by default for spreadsheet compatibility and can be disabled for systems that do not want it. Choose comma, semicolon, or tab according to the importer.
CSV contains text fields but does not carry a reliable column-type schema. The exporter preserves the characters 001 in the example; Excel can still interpret them as the number 1. Use Excel's text/CSV import flow and set identifier columns to Text. Quoting a CSV field alone does not guarantee that Excel preserves its type.
The same applies to long account numbers and dates. Export long identifiers as JSON strings and explicitly choose the destination column type.
Understand formula protection
Spreadsheet formula protection is on by default. It adds a leading apostrophe to potentially executable text, including column headers. A text value beginning with =, +, -, @, or a relevant leading control character is treated cautiously. Actual numeric values, such as the number -3, remain numeric.
This protection changes the exported text intentionally. Keep it enabled for untrusted spreadsheet data; turn it off only when the receiving system requires exact text and you understand how that system treats cells.
File and preview limits
Use Choose local JSON, paste JSON, or load Try example, then press Generate CSV. This tool accepts up to 1 MB of UTF-8 JSON, nesting depth 100, 20,000 records, and 200 columns. The generated CSV is limited to 8 MB of UTF-8 output. Exceeding a limit produces an error rather than a partial export; a long-running conversion can be cancelled and has a time limit.
Duplicate object keys, unsafe integers, number literals requiring additional precision, and negative zero are rejected. Preserve long IDs or exact decimal values as strings in the source when that is the application's contract.
The preview shows the first 20 rows and abbreviates long headers or cell values with a visible marker. Copy and download contain the complete accepted export, including values abbreviated in the preview. A generated CSV is not a lossless JSON backup: flattened paths, empty cells, and array settings affect how data is represented.
For larger recurring jobs, adapt the Python processing workflow. To check whether an API response changed before exporting it, compare two responses.