JSON to CSV Converter
Turn JSON or JSON Lines into spreadsheet-ready CSV or TSV with controlled record selection, nested-value shaping and formula-risk warnings.{{ summaryTitle }}
{{ csvDocument }}
{{ chartMessage }}
| # | {{ header }} | Copy |
|---|---|---|
| {{ row.index }} | {{ cell.value }} |
| Check | Value | Evidence | Copy |
|---|---|---|---|
| {{ row.label }} | {{ row.value }} | {{ row.detail }} |
A nested JSON response rarely arrives shaped like a spreadsheet. JSON can hold objects inside objects, arrays of different lengths, missing properties, booleans, nulls, and numbers. A delimited table needs one repeatable row shape and a stable column order, so conversion begins with a structural decision rather than a file-extension change.
One complete JSON document may contain the records at its root or under a wrapper such as data or items. JSON Lines takes a different approach: each nonblank line is an independent JSON value. Both forms can describe the same records, but a malformed line in JSON Lines must be corrected before the table can be trusted.
| Nested value | Table representation | Main tradeoff |
|---|---|---|
| Object | Expand leaf values into path-named columns | Easy to filter, but wide structures can create many columns. |
| Primitive array | Expand by index or join into one cell | Indexed columns preserve position; joined text is more compact. |
| Object or array | Keep serialized JSON in one cell | Preserves the branch, but spreadsheet formulas cannot address its inner values directly. |
| Missing or null value | Use a blank cell or an explicit token | A blank may hide the difference between absent data and an intentional empty value. |
CSV is also a family of dialects. A comma is common, while tabs, semicolons, and pipes may fit regional settings or import tools better. Delimiters, quotes, embedded line breaks, edge spaces, and header expectations all affect whether another program reconstructs the intended cells.
Spreadsheet safety deserves separate attention. Text beginning with formula characters may be evaluated when a CSV is opened. Prefixing common formula-like values can reduce that risk, but it cannot prove that an export from untrusted data is harmless. The selected records and suspicious cells still need review.
How to Use This Tool:
Choose the intended row set before adjusting its table shape. A valid parse can still produce the wrong CSV when the records come from the wrong branch.
- Paste the source or load one local JSON, JSONL, NDJSON, or text file. Leave Input format on Auto detect unless you need to require one complete JSON document or one value per nonblank line.
- Set Record source. Auto uses a root array or a top-level array under common wrapper keys; choose Use custom path for a specific branch such as
response.itemsorrows[0].children. - Choose how Nested values become cells and select the delimiter expected by the receiving program. Keep Header row on when the importer needs column names, and keep Spreadsheet formula guard on for spreadsheet-bound data from untrusted sources.
- Review the generated rows, column coverage, selected source path, and warning notes before copying or downloading the delimited document.
Interpreting Results:
The row and column totals confirm the emitted rectangle, not that the right branch was chosen. Compare the reported source path with the original JSON and inspect representative rows before importing the file.
Column coverage reveals sparse fields and mixed value types. A high blank-or-missing count may be correct for optional data, or it may show that records with different shapes were combined. The conversion audit records the parser, nesting policy, delimiter, headers, quote mode, and formula guard used for the current output.
An apostrophe added by the formula guard is an intentional change to the cell text. Treat guarded cells as a review list, especially when the data came from users, logs, crawls, or third-party feeds.
Technical Details:
JSON-to-CSV conversion maps a tree into a rectangle. The important choices are which value supplies the records, how nested branches become columns, and how each cell is serialized so a delimited-text reader can reconstruct it.
Transformation Core:
| Stage | Rule | Failure or review point |
|---|---|---|
| Parse | Read one complete JSON value, or parse every nonblank line as an independent JSON value. | Malformed JSON or one malformed JSON Lines record stops conversion. |
| Select records | Use the root, a dot-and-index path, or an auto-detected top-level array. | A missing or invalid path stops conversion; an unintended valid path needs human review. |
| Flatten | Walk each selected record and emit path columns, join primitive arrays, or serialize nested branches. | The chosen policy changes the receiving schema and can change the column count. |
| Unify columns | Add headers in first-appearance order across all selected records. | Later records can introduce new columns; absent properties become the blank-cell token. |
| Serialize | Apply the delimiter, header choice, quoting, blank token, and formula guard to every row. | The receiving importer must use the same dialect assumptions. |
Nested-Value Mapping:
| Policy | Example path or value | Result |
|---|---|---|
| Path columns | team.name, skills[0] | Objects and arrays expand recursively into separate columns. |
| Join primitive arrays | ["a","b"] | Primitive members share one cell using the selected join token; complex arrays remain serialized JSON. |
| Stringify nested values | {"region":"UK"} | A nested object or array remains JSON text in one cell. |
| Scalar row | 0 or true | A single column named value represents the scalar. |
Rule Core:
The field rules prevent delimiters and line breaks from silently changing the table shape.
| Condition | Emitted form |
|---|---|
| A cell contains the delimiter, a double quote, a line break, or leading or trailing whitespace | Wrap it in double quotes and double every embedded quote. |
| Quote every cell is selected | Quote every field, including headers. |
Formula guard is on and a value begins, after optional whitespace, with =, +, or @ | Prefix the complete text with an apostrophe before CSV quoting. |
| A property is absent, null, or undefined | Emit the configured blank-cell token. |
A compact worked path shows the structural effect. For {"items":[{"id":1,"tags":["a","b"]},{"id":2,"tags":["c"]}]}, selecting items and joining primitive arrays produces headers id and tags, then rows 1,a | b and 2,c with the default join token.
Input text is limited to 1,000,000 characters, local files to 1 MB, custom record paths to 160 characters, custom delimiters to four characters, and the on-page preview to 10 to 1,000 rows. The preview limit does not truncate the generated document.
Privacy and Safety Notes:
The source is read and converted in the browser; local file selection does not upload it. A copied, downloaded, or shared artifact can still expose the original records.
- Formula guarding covers only the leading characters named above and does not make untrusted spreadsheet data universally safe.
- CSV dialects differ across spreadsheet, database, and regional settings. Test the delimiter, headers, quoting, and character handling in the actual receiving program.
- Flattening is deterministic, but it changes structure. Keep the same record path and nested-value policy when comparing repeated conversions.
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 Files, RFC Editor, October 2005.
- JSON Lines, JSON Lines documentation.
- CSV Injection, OWASP Foundation.