JSON to CSV Converter
Turn nested JSON or JSON Lines into spreadsheet-ready CSV or TSV, with record-path selection, flattened headers, previews, and formula warnings.Conversion result
{{ csvOutput }}
| # | {{ header }} | Copy |
|---|---|---|
| {{ row.index }} | {{ cell.value }} | |
| No converted rows to preview. |
| # | CSV header | JSON path | Present | Blank | Type mix | Sample value | Copy |
|---|---|---|---|---|---|---|---|
| {{ column.index }} | {{ column.header }} | {{ column.path }} | {{ column.present }} | {{ column.blank }} | {{ column.typeMix }} | {{ column.sample }} |
| Area | Setting | Value | Evidence | Copy |
|---|---|---|---|---|
| {{ row.area }} | {{ row.setting }} | {{ row.value }} | {{ row.evidence }} |
JSON and CSV solve different parts of the same data-sharing problem. JSON is comfortable with nested objects, arrays, booleans, nulls, and uneven records. CSV is built for repeated rows where each cell is plain text and each column has a stable position. Moving data between them is less about changing a file extension and more about deciding which JSON value should become a row, which nested keys deserve columns, and which details should stay compact.
The first practical question is record identity. An API response may wrap the real records under data, items, results, records, or rows. A log export may use one JSON value per line. A single object can also become one row, but that is only useful when the object itself is the thing being tabulated rather than a container around another list.
- Record
- The JSON value that should become one CSV row.
- Path
- A dot or bracket route to a nested value, such as
payload.itemsorrows[0].children. - Header
- The column name created from a key, nested key path, or array index.
- Delimiter
- The character or short token that separates cells in the delimited text.
Flattening nested JSON is a schema choice. Expanding every object key and array index creates a wide table that is easier to filter, sort, and audit. Joining primitive arrays keeps short tag lists readable. Stringifying complex child values keeps fewer columns and preserves detail for a later parser, but it also makes spreadsheet filtering less precise.
CSV has conventions rather than one universal dialect. RFC 4180 gives a common baseline for comma-separated files, header rows, double-quote escaping, and line handling, while spreadsheet and database importers still differ by delimiter, regional settings, and quote expectations. A comma inside a value, a line break in a note, or a space at the edge of a cell can change how another program reads the row if quoting is wrong.
Spreadsheet-bound CSV needs an extra safety check. Some spreadsheet programs evaluate cells that begin with formula characters, so untrusted data can become active content when opened. A converter can reduce common formula-looking cells, but review still matters when the data came from users, scraped pages, logs, or any source that may contain hostile text.
How to Use This Tool:
Start by choosing the row set. Delimiter, nesting, headers, and formula protection only make sense after the intended records are clear.
- Paste data into JSON source, browse for a
.json,.jsonl,.ndjson, or.txtfile, or drop the file onto the input area. The summary moves from a waiting state to a converted row count after parsing succeeds. - Choose Record source. Use Auto detect records for root arrays, JSON Lines, and common wrapper keys such as
data,items,results,records, androws. Use Use root value for one object or scalar value. - Enter Record path only when Use custom path is selected. Check the summary path and row count before trusting the CSV.
- Select Nested values. Use path columns for audit-friendly tables, joined primitive arrays for compact labels or tags, and stringified nested values when preserving child objects in one cell is more important than separate columns.
- Set Output delimiter. Comma produces normal CSV, tab produces TSV-style text, semicolon and pipe fit common import variants, and Custom delimiter accepts a one- to four-character token.
- Keep Header row on unless the receiving system already knows the column order. Keep Spreadsheet formula guard on for files likely to be opened in spreadsheet software.Formula guard prefixes cells that start with
=,+, or@after leading whitespace. It is a partial spreadsheet safety guard, not a full sanitizer for every CSV injection pattern. - Open Advanced when Quote mode, Blank cell token, Array join token, or Preview rows must match a target importer.
- Review CSV Table, then compare Record Preview, Column Ledger, and Conversion Audit. Fix parse errors, missing record paths, empty selected arrays, or an unexpected row count before copying or downloading.
Interpreting Results:
The row count is the first trust check. It should match the real-world records you meant to export, not the number of objects, braces, or lines in the original text. A one-row result from a wrapped API response usually means the selected record source is the wrapper instead of the array inside it.
CSV Table is the final delimited text. Record Preview shows the converted rows in a table view and may be limited by Preview rows, while the generated CSV still includes all converted rows. Column Ledger shows which headers are sparse, which cells are blank, which value kinds appeared, and which sample value represents each column.
Conversion Audit is the place to catch false confidence. Confirm the record source, source path, delimiter, quote mode, nested-value policy, header setting, formula guard status, warning notes, and coverage counts before importing. A parse success only proves that the input was readable; it does not prove that the selected path, delimiter, or flattening policy matches the system that will receive the file.
Treat formula warnings as a reason to slow down. An apostrophe-prefixed cell is usually safer for human spreadsheet viewing, but spreadsheet applications and later save/open cycles can behave differently. Review suspicious cells before sharing a file built from untrusted data.
Technical Details:
JSON is a tree-shaped data format. Objects contain named values, arrays contain ordered values, and the leaves can be strings, numbers, booleans, or null. CSV is a rectangular text format. Each row has fields separated by a delimiter, and each field is serialized as text. Conversion therefore has to choose a row set, flatten or preserve nested branches, derive a header order, and quote cells that would otherwise be misread.
Header order follows first appearance across the selected rows. Later records can add columns when they contain paths that earlier records did not. Missing values, explicit nulls, blank strings, and configured blank tokens should be reviewed separately because they can mean different things in the system that produced the JSON.
Transformation Core:
| Stage | Rule | Review Point |
|---|---|---|
| Parse input | One complete JSON value is tried first. If that fails and multiple nonblank lines exist, each line is parsed as JSON Lines. | A malformed JSON value or bad line stops conversion with a parse message. |
| Select records | Rows come from the root value, an auto-detected top-level array, or a custom path. | The summary path and row count should match the intended data set. |
| Normalize rows | Array items become rows. A single object becomes one row. Scalar values are wrapped into a value column. | Unexpected one-row output usually points to the wrong record level. |
| Flatten cells | Objects use dot paths, arrays use bracket paths, joined primitive arrays use the array join token, and stringified nested values stay as compact JSON text. | Column Ledger shows the resulting headers, samples, blanks, and type mix. |
| Serialize fields | Header row, delimiter, quote mode, doubled quotes, edge whitespace, line breaks, and formula guard are applied. | CSV Table is the final delimited output. |
Nested Value Policies:
| Policy | Behavior | Best Fit |
|---|---|---|
| Flatten objects and arrays into path columns | Nested objects and arrays expand until scalar cells are reached. | Filtering, schema discovery, and column-by-column review. |
| Flatten objects, join primitive arrays | Objects expand, while arrays of simple values join into one cell. | Tags, roles, labels, and other short lists. |
| Stringify nested objects and arrays | Complex nested values are written as compact JSON text in one cell. | Keeping column count small while preserving child data for later parsing. |
CSV Field Rules:
| Condition | Output Behavior | Why It Matters |
|---|---|---|
| Cell contains the selected delimiter | The cell is wrapped in double quotes. | The delimiter stays inside the value instead of starting a new field. |
| Cell contains a double quote | The cell is quoted and each quote is doubled. | CSV parsers can preserve the quote character. |
| Cell contains a line break or edge whitespace | The cell is quoted. | Multiline text and significant spaces stay intact. |
| Quote mode is Quote every cell | Every emitted field is double-quoted. | Strict importers get a uniform field style. |
Formula guard is on and text starts with =, +, or @ after leading whitespace | An apostrophe is prefixed before quoting. | Many spreadsheet apps read the value as text instead of evaluating it. |
JSON Lines parsing ignores blank lines, but each remaining line must be a complete JSON value. A single bad line stops conversion so that later rows do not silently shift. JSON syntax remains strict: comments, trailing commas, and single-quoted strings are not accepted as JSON.
For repeatable conversions, keep the delimiter, record source, nested-value policy, header row, quote mode, blank token, array join token, and formula guard unchanged. Changing any of those choices can alter column count, cell text, or import behavior even when the underlying JSON records are the same.
Privacy and Accuracy Notes:
Pasted text and selected or dropped files are read in the browser for this conversion. The CSV text, preview tables, audit rows, and JSON result summary are generated from the current page state.
- Accepted file names include
.json,.jsonl,.ndjson, and.txtwhen the content can be read as text. - CSV import behavior varies across spreadsheet, database, and regional settings. Check delimiter, quote mode, and header-row expectations against the receiving system.
- Formula guard covers only the formula-starting characters handled by this conversion. OWASP guidance describes additional spreadsheet injection patterns that still need review for untrusted exports.
Worked Examples:
Wrapped API records
For {"data":[{"id":101,"team":{"name":"Data"}}]}, Auto detect records should choose $.data. CSV Table should include headers such as id and team.name, and Column Ledger should show both fields present for the selected row.
JSON Lines event export
A log file with one object per nonblank line is parsed as JSON Lines when it is not one complete JSON document. Conversion Audit reports the line-based shape. If line 3 is malformed, conversion stops with a JSON Lines parse error for that line instead of producing a partial CSV.
Tag list flattening
A product record containing "tags":["new","sale","clearance"] can become one readable tags cell when primitive arrays are joined with | . Path-column mode creates tags[0], tags[1], and tags[2] instead, which is better when each position needs separate review.
Spreadsheet formula-looking text
A note value such as "=IMPORTXML(...)" should be treated as suspicious in spreadsheet-bound output. With Spreadsheet formula guard on, the value receives an apostrophe prefix before serialization, and Conversion Audit records that the guard was enabled.
FAQ:
Can one JSON object become CSV?
Yes. Use root value or Auto detect records can turn one object into one row. A scalar root value becomes a single value column.
Why did Auto detect choose the wrong rows?
Auto detect records checks a root array, JSON Lines, preferred wrapper keys, and then the first top-level array it finds. Switch to Use custom path when the real rows sit elsewhere.
Why did I get a JSON Lines parse error?
The input did not parse as one complete JSON value, so each nonblank line was parsed separately. Fix the reported line or paste a valid JSON array instead.
Which delimiter should I choose?
Use comma for standard CSV, tab for TSV-style text, semicolon for many regional spreadsheet imports, and a custom delimiter only when the receiving system requires a token that does not appear in the data.
Why are some cells blank?
Blank cells can come from missing fields, null values, empty strings, or the configured Blank cell token. Check Column Ledger and Conversion Audit to separate sparse data from intentional blanks.
Does formula guard make untrusted CSV safe?
No. It prefixes cells beginning with =, +, or @ after leading whitespace, but it does not cover every spreadsheet injection pattern. Review untrusted cells before opening or sharing the file.
Glossary:
- Record source
- The JSON value chosen to become the CSV row set.
- JSON Lines
- A line-oriented format where each nonblank line is one JSON value.
- Path column
- A CSV header derived from a nested object key or array index.
- Formula guard
- A text prefix applied to selected spreadsheet formula-looking cells.
- Column Ledger
- The result table that shows headers, presence, blank counts, type mix, and sample values.
- Conversion Audit
- The result table that records settings, warning notes, and coverage counts.
References:
- RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format, RFC Editor, December 2017.
- RFC 4180: Common Format and MIME Type for Comma-Separated Values (CSV) Files, RFC Editor, October 2005.
- JSON Lines, JSON Lines documentation.
- CSV Injection, OWASP.