JSON to CSV
Paste JSON, get CSV. Nested objects become columns and long ids keep every digit. It stays in your browser.
https://flxcode.com/json-to-csv/
Stays in this page. Nothing is saved, shared or sent. Text up to 1 MB. For larger files use Open file (up to 50 MB).
id,name,tags,address.city,address.zip,note 12345678901234567890,Ann Lee,a;b,Kraków,30-001,"said ""hi"", then left" 2,Bo,,Łódź,,'=1+1
Converted. 2 rows, 6 columns, comma-separated, with a header row. 1 cell started with = + - or @ and got a leading ' so a spreadsheet will not run it as a formula.
No ads. No account. Nothing you type or record is uploaded. We count page events with a daily code. Check it. What this tool keeps and sends.
Problem or idea? Email us
Quick start
- Paste JSON in the left box, or choose Open file. A small sample is already there.
- The CSV appears on the right and updates when you change something.
- Pick the delimiter, and what to do with arrays.
- Copy it, or download
converted.csv.
The input can be an array of objects (the usual API export), an object of objects (the keys go in a key column), or a single object (one row). Need to check or tidy the JSON first? Use the JSON formatter. The other direction is CSV to JSON. To open the CSV in Excel as a proper .xlsx file, use CSV to Excel.
Worked examples
Each result below was made by the same code as the tool, when this page was built.
Nested objects become dot paths
JSON
[{"id": 1, "user": {"name": "Ann", "geo": {"city": "Kraków"}}}] CSV
id,user.name,user.geo.city 1,Ann,Kraków
A long id keeps every digit
JSON
[{"id": 12345678901234567890, "price": 2.50}] CSV
id,price 12345678901234567890,2.50
Arrays: join with ;
JSON
[{"id": 1, "tags": ["red", "blue"]}] CSV
id,tags 1,red;blue
Arrays: index columns
JSON
[{"id": 1, "tags": ["red", "blue"]}] CSV
id,tags.0,tags.1 1,red,blue
Arrays: explode to rows
JSON
[{"id": 1, "tags": ["red", "blue"]}] CSV
id,tags 1,red 1,blue
Commas, quotes and a formula
JSON
[{"say": "hi, \"you\"", "cell": "=1+1", "n": -5}] CSV
say,cell,n "hi, ""you""",'=1+1,-5
What the options do
- Columns are the union of all keys, in the order they first appear. A record without a key leaves that cell empty.
nulland{}and[]give an empty cell.trueandfalseare written as they are.- Numbers are copied as written.
1.0stays1.0. - Line breaks are CRLF, as in RFC 4180. A cell is quoted when it has the delimiter, a quote or a line break, or when you choose quotes around every cell.
- The formula guard is on by default. It only touches text values, never numbers.
- If the same key appears twice in one object, the last value wins and the key keeps its first place, like
JSON.parse.
Limits
- CSV has no types. Everything you write comes back as text when you read it again, unless the reader guesses.
- A list that holds objects, joined into one cell, is written as compact JSON text inside the cell.
- Index columns: an empty list adds no column. If every record has an empty list, one empty column with the key name is kept.
- No Excel file (.xlsx) output. CSV and nothing else.
- Input is read as UTF-8, the output is UTF-8.
How it works and privacy
The JSON is read once by the same strict parser as the formatter, so errors show the line and column and numbers are never converted to floating point. The rows are flattened and written out in your browser. Files go to a background worker. We count events without cookies, like "download used" (details). Your data is never part of them.
FAQ
How are nested objects handled?
They are flattened into columns named with dot paths. {"user": {"name": "Ann"}} gives a column user.name. A key that already contains a dot is not told apart from a nested one.
What happens to arrays?
You pick. Join with ; puts a list in one cell, like red;blue. Index columns make tags.0, tags.1 and so on. Explode to rows writes one row per item and repeats the other cells. Two arrays in one record multiply: 3 and 4 items make 12 rows. The page stops at 1,000,000 rows.
Why does a cell start with an apostrophe?
A spreadsheet runs a cell that starts with =, +, - or @ as a formula. A text value like =HYPERLINK(...) in a JSON export can do harm when you open the CSV. The page adds a leading apostrophe to such text values. Real numbers like -5 are not touched. Untick the box if you need the raw text.
Excel shows strange characters for é or ł. Why?
Excel guesses the encoding of a CSV and often guesses wrong when there is no marker. Tick "UTF-8 byte order mark" and download again. Google Sheets and most other tools do not need it, and the mark can confuse tools that do not expect it.
Do big numbers survive?
In the file, yes. 12345678901234567890 is written with every digit. Excel itself keeps 15 significant digits of a number, so it will show 12345678901234500000 or 1.23457E+19. To keep all digits in Excel, import the column as text (Data, From Text/CSV) instead of double-clicking the file.
Does it read JSON Lines or several JSON values?
No. The input has to be one JSON value, usually an array of objects. For one object per line, wrap the lines in [ ] and put a comma between them first.
More from FLXCode
- CSV to Excel ConverterTurn CSV files into an Excel .xlsx file. Leading zeros, long numbers and dates stay as they are. Nothing is uploaded.
- CSV to JSONTurn CSV into JSON with the delimiter found for you. Codes like 00123 and 20-digit ids stay text, nothing is uploaded.
- JSON FormatterFormat, minify, sort and check JSON in your browser. Big numbers stay exact and errors show line and column.
- Regex TesterTest JavaScript regular expressions with live matches, groups, flags and a replace preview. Runs in your browser.