Like ToolFern? Prefer us as your source on Google →

JSON to CSV / CSV to JSON

Convert a JSON array of objects into a clean CSV spreadsheet, or turn CSV back into pretty-printed JSON, both directions.

How to use it

  1. Paste your data into the input box, a JSON array of objects, or raw CSV.
  2. Pick a delimiter (comma, semicolon or tab) and leave Flatten nested objects checked unless you want nested data kept as raw JSON in one cell.
  3. Click JSON → CSV to flatten objects into a spreadsheet, or CSV → JSON to build a list of objects.
  4. Copy the result, or fix any error shown in red and try again.

JSON → CSV: how the conversion works

Your input must be a JSON array of objects, for example [{"name":"Ada","role":"Engineer"}, {"name":"Linus"}]. The tool scans every object and builds the header row from the union of all keys, in the order they first appear. That means objects do not all have to share the same keys, missing values simply become empty cells.

Every value is escaped to valid CSV: if a value contains the chosen delimiter, a double quote or a line break, the whole cell is wrapped in double quotes, and any quotes inside are escaped by doubling them (" becomes "").

With Flatten nested objects on (the default), a nested object becomes its own dot-notation column: {"user":{"name":"Ada"}} turns into a column named user.name. Arrays work the same way, using the index as the next part of the name, so {"tags":["a","b"]}becomes tags.0 and tags.1. An array of objects, the trickiest case, combines both rules: index first, then key. So{"addresses":[{"city":"NYC"},{"city":"LA"}]} becomes two columns, addresses.0.city and addresses.1.city. An empty object or empty array has no key to build a column from, so it is written as the literal text {} or [] in its own cell rather than being dropped. Turn the checkbox off to go back to writing nested objects and arrays as compact JSON inside a single cell instead.

CSV → JSON: how the conversion works

The CSV reader follows RFC 4180, the de-facto CSV standard, using whichever delimiter you picked, comma, semicolon or tab. Fields can be wrapped in double quotes, and a quoted field may contain the delimiter, line breaks, and escaped quotes (""). The first row is treated as the column names, and every following row becomes one JSON object mapping those names to values. The output is pretty-printed with two-space indentation so it is easy to read and diff.

With Flatten nested objects on, a dotted column name like user.name is rebuilt into a nested object, and a run of columns whose names are plain numbers, like tags.0 and tags.1, is rebuilt as an array instead of an object. Turn the checkbox off to keep every column as a flat, literal key with no nesting.

Common uses

Frequently asked questions

Why does JSON → CSV say my input is not an array?

JSON → CSV needs the top level to be an array of objects, like [{.}, {.}]. A single object or a bare value cannot be turned into rows.

What happens to objects with different keys?

The header is the union of all keys across the array. Objects missing a key get an empty cell for that column, so no data is dropped.

Does CSV → JSON guess data types?

No, every value is kept as a string to stay lossless and predictable. If you need numbers or booleans, cast them after conversion.

How does the tool handle nested objects?

With Flatten nested objects turned on (the default), a nested object like {"user":{"name":"Ada"}} becomes a column named user.name. CSV → JSON reverses this: a column named user.name gets rebuilt into a nested object.

How are arrays inside objects flattened?

Arrays use the index as the next part of the column name, so {"tags":["a","b"]} becomes tags.0 and tags.1. An array of objects combines both rules, index first, then key, so {"addresses":[{"city":"NYC"}]} becomes addresses.0.city. An empty object or array is written as the literal text {} or [] so it round-trips instead of disappearing.

Can I use a delimiter other than a comma?

Yes. The delimiter dropdown supports comma, semicolon and tab, and applies to both JSON → CSV and CSV → JSON.

Related: JSON Formatter · Base64 encode/decode

Found this useful? Share it