JSON to CSV Converter - Flatten Nested Data

2on /
/ Converters / JSON to CSV

JSON to CSV converter

or

What this tool does

Somebody sent you an API response and somebody else wants it in a spreadsheet. That is the whole job - and it is harder than it looks, because JSON is a tree and a spreadsheet is a grid. This page makes the three decisions that turn one into the other, and shows you what it decided.

How to use it

  1. 1 Paste the JSON, or drop a .json file.
  2. 2 Pick the delimiter - use a semicolon if the file is for Excel.
  3. 3 Press Convert, then copy the result or download the .csv.

A tree does not fit in a grid, so it gets flattened

A nested object becomes a dotted column: {"city":{"name":"London"}} turns into a column called city.name. Without this a converter writes "[object Object]" into the cell - the file opens, looks valid, and half your data is gone. Lists of plain values are joined into one cell; lists of objects get numbered columns instead.

JSON
[
  {
    "name": "Ada",
    "city": { "name": "London" },
    "note": "Loves \"tea\""
  },
  {
    "name": "Grace",
    "city": { "name": "New York, NY" },
    "tags": ["math", "navy"]
  }
]
CSV
name,city.name,note,tags
Ada,London,"Loves ""tea""",
Grace,"New York, NY",,math; navy

Columns come from every row, not the first one

Records in real data rarely have identical fields: an optional field appears on the fortieth record and nowhere before it. A converter that reads only the first record silently drops that column, and nothing in the output says so. Here the header is the union of every key seen, in the order they first appear, and records missing a field get an empty cell.

One stray comma shifts every column

Any value containing the delimiter, a quote mark or a line break has to be wrapped in quotes, and quotes inside it doubled. That is what the CSV standard asks and it is the part converters most often get wrong. An address with a comma in it, a comment with a line break, a name with an apostrophe - each of them silently breaks a file that skips this step.

Excel breaks CSV files in two different ways

First, without a byte-order mark it reads UTF-8 as the local code page, so accented and non-Latin characters turn to mush. Second, in many locales it expects a semicolon, not a comma, and puts every row into a single column. Both are options here, and both default to off - because the standard says comma and no mark, and the file usually goes to a script rather than a spreadsheet.

JSON to CSV - frequently asked questions

Objects become dotted columns, so user.address.city is one column. Arrays of plain values are joined into a single cell separated by "; " - you can turn that off and get numbered columns instead. Arrays of objects always get numbered columns (tags.0.name, tags.1.name), because squeezing them into one cell would lose the structure entirely.
New
PDF to Text Pull the text out of a PDF without uploading it. Choose a page range, keep the line breaks or flow the paragraphs, then copy or download a .txt file.
Popular Today
JPG to WebP Convert JPG to WebP for free: cut image weight for faster pages while choosing the quality yourself, all inside your own browser.

Related Converters

Word to PDF Convert Word to PDF for free: upload a DOC, DOCX, ODT or RTF file and download a properly formatted PDF in seconds - no registration or watermark.
PDF to Word Convert PDF to Word for free: upload a PDF and download an editable DOCX in seconds - no registration, no watermark and nothing to install.
Image Converter Free image converter: pick PNG, JPG, WebP, GIF or BMP and convert any picture in your browser - your photos are never uploaded to a server.
WebP to PNG Convert WebP to PNG for free: transparency is preserved and the image never leaves your device - the whole conversion runs in your browser.
PNG to JPG Convert PNG to JPG for free: pick the quality and a background colour for transparent areas, all in your browser with no upload.

Other Tools You May Like

MD5 Hash Generator Free MD5 hash generator: turn any text or file into an MD5 checksum in your browser - useful for integrity checks and quick fingerprinting.
Base64 Encoder & Decoder Free Base64 encoder and decoder: convert text or files to Base64 and back, entirely in your browser - nothing is uploaded to a server.
Word Counter Free word counter: paste any text to count words, characters, sentences and paragraphs, and see the estimated reading time - nothing leaves your browser.
Character Counter Free character counter: count characters with and without spaces, plus words and lines, and check SEO limits for titles and meta descriptions.
Keyword Density Checker Free keyword density checker: paste text or a URL to see how often each word and phrase appears, with percentages for one, two and three-word terms.