JSON ↔ CSV Converter

An API hands you a JSON array; the person waiting on it wants a spreadsheet. This converter bridges the two: paste a JSON array of objects and it builds a CSV with one row per object and one column per key, ready for Excel, Google Sheets or any database import. Flip the tab and it runs the other way — a CSV table with a header row becomes a clean JSON array of objects, handy for test fixtures, seed data and config files.

The awkward cases are handled on purpose, not by luck. Nested objects flatten into dot columns like address.city. Records that don’t all share the same keys still line up, because the columns are the union of every key in the data. And the quoting follows the CSV standard exactly, so a comma inside a company name or a quote inside a note can’t split a row in half.

Both directions live on this one page and share one flow, which makes round trips painless: convert out to CSV, edit the table in your spreadsheet, then send the output back as input and convert it home to JSON. Everything runs in your browser — your data is never uploaded anywhere.

Laptop with a blurred spreadsheet grid beside a printed table, a pen and a mug of coffee on a desk

JSON ↔ CSV Converter

Convert a JSON array into spreadsheet-ready CSV, or turn a CSV table back into JSON — both directions in one place, with nested objects flattened into dot columns and proper quoting throughout.

The rules, so nothing is a surprise. JSON → CSV: each object becomes a row, and the columns are the union of every key in the data, in the order keys first appear — a record missing a key simply gets an empty cell. Nested objects flatten into dot columns (address.city); a list of plain values joins into one cell with “; “; a list containing objects is kept as JSON text in its cell, because splitting it would invent rows you didn’t ask for. Null becomes an empty cell. Any field containing the delimiter, a quote or a line break is wrapped in double quotes, with its own quotes doubled — the standard RFC 4180 quoting every spreadsheet expects. CSV → JSON: the first row is the header and becomes the keys; every value comes back as a string, because CSV itself stores no types — a 42 in your CSV is the text “42” in the JSON, ready for your code to interpret. Quoted fields are parsed properly, so commas, quotes and line breaks inside quotes survive the trip. Blank lines are ignored, a repeated header gets a _2 suffix, and rows shorter than the header are filled with empty strings. Everything is converted locally in your browser; your data never leaves this page.

How it works

Going JSON → CSV, each record is flattened first. The converter walks every object recursively: a nested object becomes dotted keys (address.street, address.zip), a list of plain values joins into a single cell with "; " between items, and a list that contains objects is kept as JSON text in its cell — splitting it into rows would invent data you didn't ask for. Null becomes an empty cell; numbers and booleans are written as their plain text. The header row is then built from the union of all flattened keys, in the order they first appear across the records, so a key that only shows up in record nine still gets its column.

The output follows RFC 4180, the CSV standard spreadsheets actually read: any field containing the chosen delimiter, a double quote or a line break is wrapped in double quotes, and quotes inside it are doubled. You can switch the delimiter — comma, semicolon, tab or pipe — for the spreadsheet locales and import tools that expect one.

Coming back, CSV → JSON uses a real parser rather than a naive split on commas. It understands quoted fields, doubled quotes, line breaks inside quotes and CRLF files. The first row becomes the keys; every value is returned as a string, because CSV itself stores no types — a 42 in the table is the text "42" in the JSON, ready for your code to interpret as it likes. Blank lines are ignored, a repeated header name gets a _2 suffix instead of silently overwriting a column, and a row shorter than the header is filled out with empty strings. If the JSON won't parse, the error message points at the line and column where parsing failed; if a CSV quote is never closed, the message names the line it opened on.

How to use it

  1. Pick a direction with the tabs at the top — JSON → CSV or CSV → JSON.
  2. Paste your data into the input box, upload a .json, .csv or .txt file, or press Load a sample to see a deliberately awkward example handled.
  3. Choose a delimiter if your spreadsheet expects something other than a comma. For CSV input, Auto-detect reads the first line and picks the delimiter for you; for JSON → CSV you can also turn the header row off.
  4. The conversion happens as you type. Check the row and column count under the result, and glance at the preview table — it shows the first rows exactly as a spreadsheet will read them.
  5. Press Copy result or Download to take the file away, or Send output back as input to convert the result straight back in the other direction.

A worked example

Press Load a sample in the JSON → CSV tab and the tool fills in two records chosen to be difficult — a comma inside a city, a quote inside a note, a nested address, a tag list, and a vip key that only one record has:

[
  {
    "id": 1,
    "name": "Ana Torres",
    "city": "Austin, TX",
    "tags": ["gift", "express"],
    "address": { "street": "12 Oak St", "zip": "73301" },
    "note": "She said \"hi\""
  },
  {
    "id": 2,
    "name": "Ben Osei",
    "city": "Leeds",
    "tags": ["retail"],
    "address": { "street": "4 Mill Rd", "zip": "LS1 4DY" },
    "vip": true
  }
]

The output is 2 rows × 8 columns:

id,name,city,tags,address.street,address.zip,note,vip
1,Ana Torres,"Austin, TX",gift; express,12 Oak St,73301,"She said ""hi""",
2,Ben Osei,Leeds,retail,4 Mill Rd,LS1 4DY,,true

Read what happened: the address became address.street and address.zip; the tags joined into one cell; "Austin, TX" is quoted because it contains the delimiter; the note's inner quotes doubled inside a quoted field; and each record's missing key (vip in row 1, note in row 2) is simply an empty cell. Switch the delimiter to semicolon and the quoting adapts — now the joined tags cell is the one that gets quoted, because it contains the new delimiter.

The reverse sample makes the parser earn its keep. This CSV:

name,role,quote
Ana Torres,Support,"She said ""hi, there"""
Ben Osei,Engineer,Plain note

becomes 2 records × 3 fields — and the quoted field, comma and all, arrives intact:

[
  {
    "name": "Ana Torres",
    "role": "Support",
    "quote": "She said \"hi, there\""
  },
  {
    "name": "Ben Osei",
    "role": "Engineer",
    "quote": "Plain note"
  }
]

One honest note on round trips: converting the first example's CSV back to JSON keeps the dot columns as plain keys ("address.street") and returns every value as a string — "vip" comes home as the text "true". The structure flattens one way; it doesn't pretend to rebuild the original nesting.

Who it is for

Developers turning API responses and database exports into something a spreadsheet can open; analysts who receive JSON and report in Excel or Sheets; QA engineers and developers building test fixtures and seed data from spreadsheet tables; and anyone who has ever had a hand-written conversion script quietly scramble a row and would rather watch the rules applied in the open.

Why use this tool

  • Both directions, one page — JSON → CSV and CSV → JSON behind one tab switch, with a "send output back as input" button that makes a round trip a single click.
  • Nested data handled in the open — dot-notation flattening, union-of-keys columns and list rules are printed on the tool itself, and the built-in sample is deliberately awkward so you can watch them work.
  • A real parser in both directions — RFC 4180 quoting going out, and a quoted-field parser coming back, so commas, quotes and line breaks inside your data survive the trip.
  • Errors that locate themselves — invalid JSON is reported with its line and column, and an unclosed CSV quote names the line it opened on, instead of a bare "failed".

Frequently asked questions

How do I convert JSON to CSV?

Paste a JSON array of objects into the JSON → CSV tab — or upload the file — and the CSV appears as you type, with one row per object and the keys as the header row. A single object works too; it's treated as one row. Then copy the result or download it as a .csv file.

What happens to nested objects and arrays?

Nested objects flatten into dot columns: {"address": {"city": "Leeds"}} becomes an address.city column. A list of plain values joins into one cell with "; " between items. A list containing objects is kept as JSON text in its cell, because exploding it into extra rows would change the shape of your data without asking.

Why are some cells wrapped in quotes in the CSV output?

That's the CSV standard doing its job. Any field containing the delimiter, a double quote or a line break must be quoted, and quotes inside it doubled — otherwise a value like Austin, TX would land in two columns when the file opens. Every spreadsheet and import tool expects exactly this.

Why is everything a string when I convert CSV back to JSON?

Because CSV stores no types. A spreadsheet cell holding 42 or true is just text in the file, so the JSON faithfully returns "42" and "true" as strings. Your code can convert them to numbers or booleans once it knows which columns should be which — guessing here would corrupt values like phone numbers and leading-zero codes.

What if my records don't all have the same keys?

Nothing breaks. The columns are the union of every key found in any record, in first-seen order, and a record that lacks a key gets an empty cell in that column. The same applies in reverse: a CSV row shorter than the header is filled with empty strings.

Is my data uploaded or saved anywhere?

No. Parsing and conversion run locally in your browser the moment you paste. Nothing is sent to a server, stored, or tracked — paste an unpublished API response or a client's export with confidence.

How do I convert JSON to CSV?

Paste a JSON array of objects into the JSON → CSV tab — or upload the file — and the CSV appears as you type, with one row per object and the keys as the header row. A single object works too; it's treated as one row. Then copy the result or download it as a .csv file.

What happens to nested objects and arrays?

Nested objects flatten into dot columns: {"address": {"city": "Leeds"}} becomes an address.city column. A list of plain values joins into one cell with "; " between items. A list containing objects is kept as JSON text in its cell, because exploding it into extra rows would change the shape of your data without asking.

Why are some cells wrapped in quotes in the CSV output?

That's the CSV standard doing its job. Any field containing the delimiter, a double quote or a line break must be quoted, and quotes inside it doubled — otherwise a value like Austin, TX would land in two columns when the file opens. Every spreadsheet and import tool expects exactly this.

Why is everything a string when I convert CSV back to JSON?

Because CSV stores no types. A spreadsheet cell holding 42 or true is just text in the file, so the JSON faithfully returns "42" and "true" as strings. Your code can convert them to numbers or booleans once it knows which columns should be which — guessing here would corrupt values like phone numbers and leading-zero codes.

What if my records don't all have the same keys?

Nothing breaks. The columns are the union of every key found in any record, in first-seen order, and a record that lacks a key gets an empty cell in that column. The same applies in reverse: a CSV row shorter than the header is filled with empty strings.

Is my data uploaded or saved anywhere?

No. Parsing and conversion run locally in your browser the moment you paste. Nothing is sent to a server, stored, or tracked — paste an unpublished API response or a client's export with confidence.