JSON to CSV Converter: Flatten Nested JSON
Convert JSON to CSV in your browser. Nested objects become dotted columns, arrays become numbered columns, and a formula guard keeps spreadsheets safe. Also writes TSV, YAML and XML. Nothing is uploaded.
Drag files here, paste, or choose files
CSV, TSV, JSON, YAML or XML, up to 5.0 MB. Files stay on this device.
Paste CSV, TSV, JSON, YAML or XML here, or drop a file above.
About the JSON to CSV Converter
The JSON to CSV Converter turns JSON from an API, a database export or a log into rows and columns you can open in Excel, Google Sheets or Numbers. Paste the JSON or drop a .json file, and the CSV appears as you type. Copy it, or download it under the name of your file with a .csv extension. The same page also writes TSV, YAML and XML, and the Swap button reads the CSV back.
Nothing is uploaded; every conversion runs in your browser and never leaves your device.
What JSON becomes CSV
Shapes that work
An array of objects gives a header row and one row per object. An array of arrays gives rows without a header. A single object gives one row. Anything else, such as a lone number, is refused with the message CSV needs an array of objects, an array of arrays or one object.
Nested objects and lists
Nested keys are joined with dots, so {"user": {"name": "Ana"}} gives the column user.name. List items get numbers, so "tags": ["a", "b"] gives tags.0 and tags.1. Columns appear in the order they are first seen across all rows. A value that is missing from a row, or null, is written as an empty field. A key that already contains a dot is written in quotes, such as "a.b", so that nesting back is lossless.
Quoting
A field is put in double quotes when it holds a comma, a quote, a line break, or a space at its start or end, and quotes inside it are doubled. say "hi" is written as "say ""hi""". TSV uses the same rules with a tab as the delimiter.
Formula guard and line endings
A spreadsheet treats a cell that starts with =, +, -, @, a tab or a carriage return as a formula, which can be abused when a file comes from someone else. Tick Guard against spreadsheet formulas and such a field gets a leading apostrophe, so =SUM(A1) is shown as text. Lines end with LF by default, or with CRLF for Windows programs that expect it.
Reading it back
Press Swap to turn the CSV back into JSON. Tick Nest dotted headers to rebuild the nested objects and lists from the dotted column names. Numbers and true or false values are detected again, but only when nothing would be lost, so codes such as 007 stay text.
Limits
JSON text and files up to 5 MB are converted on this device. Invalid JSON is reported with its line and column, for example Line 1, column 8: Trailing comma before "}"., and no stale output is left on screen. Integers larger than 2^53 are kept as text with a warning instead of losing digits.
Related tools
Convert in any other direction with the CSV to JSON converter, or check and pretty-print the JSON first with the JSON formatter.
Frequently asked questions
How are nested JSON objects turned into CSV columns?
Nested keys are joined with dots, so user.name becomes a column, and list items get numbers, so tags.0 and tags.1 are columns too. Columns appear in the order they are first seen, and a missing value or null is an empty field.
What JSON can be written as CSV?
An array of objects, which gives a header row and one row per object, an array of arrays, which gives rows without a header, or a single object, which gives one row. A lone number or string is refused with a message that says what CSV needs.
What does the formula guard do?
A spreadsheet runs a cell that starts with =, +, -, @, a tab or a carriage return as a formula. With the guard on, such a field gets a leading apostrophe so Excel and other spreadsheets show it as text instead of running it.
Can I turn the CSV back into nested JSON?
Yes. Swap the direction, or choose CSV to JSON, and tick Nest dotted headers. Dotted column names become nested objects again and numbered parts become lists, so the round trip is lossless for keys without dots.
Which line ending should I choose?
LF suits Mac, Linux and most tools. Choose CRLF when an older Windows program or a strict import expects RFC 4180 line endings. Fields with a comma, a quote, a line break or spaces at the edges are quoted either way.
Is my JSON sent to a server?
No. The JSON is parsed and flattened on this device, and the CSV is built in the page itself. API responses with tokens or personal data never leave your browser while you convert them.