Skip to content
Data & NetSuite utilities

JSON to CSV converter — nested keys flattened

Convert a JSON array to CSV in your browser. Column union across every object, dot-notation flattening, correct quote escaping, delimiter choice.

Free · no signup · runs in your browserUpdated
Short answer

To convert JSON to CSV, take the union of keys across every object as your columns, then write one row per object. Keys missing from an object become empty cells. Nested objects flatten with dot notation, so price.unit and price.currency each get a column, and arrays are written back as JSON text.

JSON to CSV looks like a one-liner until you meet real data. The second object has a key the first one didn't. The price is an object, not a number. One note field contains a comma, another contains a quote, and the person who needs the file only opens spreadsheets.

This converter takes the union of keys across every object in first-seen order, so a field that appears only in row 40 still gets a column. Nested objects flatten to dot notation, arrays are written back as JSON, and anything containing your delimiter, a quote or a line break is quoted and escaped properly.

Invalid JSON gets a line and column number and the text around the break, not a stack trace. Paste an array of objects, or a single object, or an API payload with one array property — that gets unwrapped for you.

An array of objects, or a single object. An object with one array property — an API payload like { rows: [ ... ] } — is unwrapped for you. Converted in your browser; nothing is uploaded.

Header row
Nested objects
CSV output
customer,item,qty,price.unit,price.currency,tags,backorder,notes
"Acme Industrial, Inc.",WIDGET-100,120,14.5,USD,"[""priority"",""net30""]",,
Baltic Fasteners,BOLT-M8,4800,0.42,EUR,,true,
Northwind Traders,PUMP-3X,12,865,USD,,,"Ships ""as is"""
Data rows3
Columns (key union)8
Flattened nested keys2
Cells filled18 of 24
Output characters244
The column list is the union of every key found, so 8 columns cover 3 rows and 3 rows leave at least one cell empty. That is expected when optional fields are omitted from an API payload — no value was dropped.

Everything is computed in your browser. Nothing you type is sent anywhere or stored.

How the JSON to CSV conversion maps each value type

JSON valueCSV cellNote
StringThe string, quoted only if it needs to beQuoted when it contains the delimiter, a double quote, a line break, or edge whitespace
NumberWritten as-isNo thousands separators and no currency symbol are added
true / falsetrue / falseLower case, so a spreadsheet reads them as booleans
nullEmpty cellIndistinguishable from a missing key once it is CSV — that is CSV's limitation, not a bug
Nested objectOne column per leaf, named parent.childTurn flattening off to keep the object as JSON text in one cell
ArrayJSON text, e.g. ["priority","net30"]Arrays have no width, so exploding them into columns would break the row shape
Missing keyEmpty cellThe column exists because another object had that key
Empty object{}Kept visible rather than blanked, so you can tell it apart from a null
Value-by-value conversion rules.

Quoting is the part that gets silently wrong

A CSV field must be wrapped in double quotes if it contains the delimiter, a double quote, a carriage return or a line feed. Inside those quotes, every literal double quote is doubled. Get it wrong and the file still opens — it just opens with the columns shifted from one row onward, which is far worse than an error.

  • Leading and trailing spaces get quoted too. Otherwise importers helpfully trim them and your keys stop matching.
  • Line endings are a choice. CRLF is what Excel on Windows expects; LF is what everything else prefers. Pick the destination, not the source.
  • Column order follows first appearance. Keys from the first object come first, later-only keys are appended on the right — stable and diffable between two exports.
  • The header row is optional. Turn it off when you are appending to a file that already has one.

Where this fits in an ERP workflow

Most ERP APIs answer in JSON and most finance people work in spreadsheets, so this conversion sits between the two constantly: a REST query result that needs to reach a controller, an integration payload someone wants to eyeball, a list of records to reconcile against a saved search.

If the payload came from a query you are still tuning, the SuiteQL formatter will make it readable first. If you are loading data rather than exporting it, the field-count and quoting rules here are the same ones that decide whether a migration file imports cleanly.

Everything runs locally

The JSON is parsed and written to CSV in your browser. Nothing is uploaded, nothing is stored, and the page works with the network disconnected — which is the only sane way to handle a payload that contains customer names and prices.

Frequently asked questions

How do I convert JSON to CSV?

Collect every key that appears in any object to form the column list, write that as the header row, then write one row per object, filling each column from the matching key and leaving a blank cell where the key is absent. Quote any value containing the delimiter, a double quote or a line break.

What happens to nested objects when converting JSON to CSV?

They flatten into one column per leaf value, named with dot notation. An object like { "price": { "unit": 14.5, "currency": "USD" } } becomes two columns, price.unit and price.currency. CSV is a flat grid, so this is the only lossless option short of writing the object into a single cell as JSON text.

How are arrays inside JSON handled?

Each array is written into a single cell as JSON text, such as ["priority","net30"]. Arrays vary in length between rows, so expanding them into columns would give different rows different widths. If you need one row per array element, restructure the JSON before converting rather than after.

Why do my JSON objects have different keys?

Because most APIs omit optional and null fields instead of sending them empty. The fix is not to reject the data but to take the union of keys across every object, which is what this converter does. Rows missing a key get an empty cell, and the row count in the stats tells you how many.

When does a CSV field need to be quoted?

When it contains the delimiter, a double quote, a carriage return or a line feed — and it is worth quoting values with leading or trailing spaces too, since importers often trim them. Inside a quoted field, each literal double quote is written twice. Unquoted delimiters are the usual cause of a file that opens with shifted columns.

Why won't my JSON parse?

Usually a trailing comma after the last element, single quotes instead of double quotes around keys or strings, or an unescaped quote inside a string. JSON allows none of the three, though JavaScript object literals allow the first two. This tool reports the line and column of the break plus the surrounding text so you can find it quickly.

All 50 ERP & finance tools

Stop calculating it by hand. Just ask your ERP.

This calculator needs you to find the inputs first. ERPray pulls them from your own ERP account and computes the answer live — with the exact query shown so you can check it.