JSON to CSV
Convert an array of JSON objects into a CSV file.
Paste a JSON array of objects (one object per row) and you'll get a CSV with one header row built from the union of all keys, plus one row per object. Escaping follows RFC 4180, so the output opens cleanly in Excel, Google Sheets and Numbers.
The input shape
The converter expects a JSON array where each element is an object — the same shape almost every API uses to return a list of records. It walks the array once, builds a header row from the union of keys it sees, and writes one CSV row per element. Missing fields become empty cells; extra fields extend the header.
[
{"id": 1, "name": "Ada", "role": "engineer"},
{"id": 2, "name": "Linus", "role": "kernel"},
{"id": 3, "name": "Grace", "role": "compiler"}
]Converts to:
id,name,role
1,Ada,engineer
2,Linus,kernel
3,Grace,compilerWhat "flat" means and why it matters
CSV is a two-dimensional format — rows and columns of scalar values. JSON is a tree. The mismatch shows up the moment your objects contain nested objects or arrays. Consider:
[
{"id": 1, "name": "Ada", "address": {"city": "London", "country": "UK"}, "skills": ["math", "computing"]}
]There is no canonical way to put address and skills into single cells. JSONNeat picks the safest option — it JSON-stringifies the nested value into the cell verbatim. You get anaddress column with the value {"city":"London","country":"UK"} and askills column with ["math","computing"]. The data is preserved exactly, but Excel can't sort, filter or chart by it.
The clean alternative is to flatten the JSON before converting — turn nested keys into dot-separated column names:
[
{"id": 1, "name": "Ada", "address.city": "London", "address.country": "UK", "skills": "math,computing"}
]Flattening is opinionated (how do you handle arrays of objects? What separator between path segments?) so JSONNeat leaves that decision to you. A one-liner with jq or the Python pandas.json_normalize function does the job consistently. Our blog has a worked example in REST API JSON best practices.
CSV escaping rules, in case you ever need to write them yourself
The converter follows RFC 4180, the de facto CSV standard. The rules are simple:
- Fields are separated by commas.
- Rows are separated by CRLF (
\r\n). - If a field contains a comma, double quote, CR or LF, the entire field is wrapped in double quotes.
- Any double quote inside a quoted field is doubled —
he said "hi"becomes"he said ""hi""". - No escape for backslash, no escape for tab. CSV is much simpler than JSON in this regard, which makes it brittle but also predictable.
The converter handles all five cases automatically. You should never have to edit the output by hand to make it open correctly in Excel or Google Sheets.
Common pitfalls
- "Cannot convert: input must be an array of objects." Your JSON is either a single object, a single value, or an array of non-object values. Wrap a single object in
[ ], or restructure your data so the rows are explicit. - Header row in unexpected order. Headers appear in first-seen order. If you want alphabetical headers, sort the keys in each object first, or post-process the output in a spreadsheet.
- Numbers shown as text in Excel. Long numeric IDs (16+ digits) can be auto-formatted by Excel as exponential notation, losing precision. Import via Data → From Text and explicitly mark those columns as Text, or prefix the value with a leading apostrophe when generating the JSON.
- Special characters look wrong in Excel. CSV doesn't carry an encoding. Save with UTF-8 and open via Data → From Text/CSV to be safe. Google Sheets and Numbers handle UTF-8 correctly by default.
- Output opens in one column. Your Excel locale uses semicolons as separators. Either use Data → Text to Columns, or save with a
.csvextension and import via the menu rather than double-clicking.
When CSV is the wrong target format
CSV is great for flat, tabular data with mostly scalar values. It struggles or fails for:
- Hierarchical data. Org charts, file trees, AST representations — anything where the shape is the data. Stay in JSON or use a graph-oriented format.
- Mixed schemas. If half your objects have
type: "user"with one set of fields and the other half havetype: "event"with a completely different set, the CSV ends up mostly empty cells. Split into two CSVs by type first. - Binary data. CSV is text. Base64-encode binary fields in the JSON before converting, or use a binary-friendly format like Parquet or Avro.
- Large datasets that need columnar access. Parquet, ORC and Arrow are dramatically more efficient for analytics workloads. CSV is fine up to a few hundred MB; beyond that, switch.
Privacy
The converter runs entirely in your browser. JSON pasted into the editor is not uploaded, logged or cached on JSONNeat's servers — safe for converting analytics exports, customer data, or production records that you would not want to leave your machine.
Frequently asked questions
- What format does my JSON need to be in?
- An array of flat objects: [{"a": 1, "b": 2}, {"a": 3, "b": 4}]. Each object becomes one row, and the union of all keys across every object becomes the column headers. Missing keys produce empty cells in that row.
- How are nested objects handled?
- Nested objects and arrays are JSON-stringified into a single CSV cell. That preserves the data losslessly but is awkward to read in a spreadsheet. For analysis-ready output, flatten your data into a single level of keys before converting (a tool like jq or a small script does this well).
- Will the CSV open in Excel?
- Yes — the output is RFC 4180-compliant CSV with proper escaping for commas, double quotes and newlines, compatible with Excel, Google Sheets, Numbers and Pandas. Save the output with a .csv extension and double-click to open.
- What character separates columns?
- A comma, as the name suggests. Some European Excel installations use semicolons because the comma is the decimal separator there — if your output opens in a single column in Excel, use Data → Text to Columns to re-split on commas, or save and re-open via File → Import.
- How are values escaped?
- Any cell that contains a comma, a double quote, or a newline is wrapped in double quotes. Any double quote inside such a cell is doubled (the RFC 4180 escape rule). Numbers, booleans and nulls are emitted as their string form: true, false, "" for null.
- Why is the header row in a different order than my JSON?
- The header row is the union of keys across all rows, in the order each key was first encountered. If row 1 has {"a", "b"} and row 2 has {"b", "c"}, the header is a, b, c — not alphabetised, not reshuffled.
- How are dates handled?
- JSON has no native date type, so dates are usually already strings in your data ("2026-05-14T10:00:00Z" or "2026-05-14"). The converter passes them through unchanged. If your dates are formatted as numbers (Unix timestamps), they will appear as numbers in the CSV.
- Can I convert a single object into CSV?
- Wrap it in an array first: {"a": 1, "b": 2} becomes [{"a": 1, "b": 2}]. The result will be a one-row CSV. The converter rejects bare objects to avoid ambiguity about whether a single object should be one row or one column.
- What about JSON Lines (NDJSON)?
- Each line is its own JSON object, not a single JSON document, so you cannot paste NDJSON directly. The easiest fix is to wrap the content in square brackets and add commas between lines, turning [a][b] into [a,b].
- How big a file can I convert?
- Anything that fits in browser memory — usually hundreds of MB. Conversion is single-pass and linear in input size. For multi-gigabyte JSON, use a streaming tool like jq -r or Pandas read_json with chunksize.