Open tools · 0

About

JSON to CSV

Paste a JSON array, an API response or JSON Lines, or drop the file, and it opens as a table ready to save as CSV or .xlsx. Each key becomes a column, in the order the keys first appear; nested objects open into columns such as address.city, and a record missing a key gets an empty cell there.

What it does

  • An API answer such as {"data": [...], "total": 2} is read from the list inside it.
  • A key holding an array keeps it as JSON text, such as ["a","b"], in one cell.
  • Numbers keep the digits they were written with, so a 20-digit id and 1.0 come through unchanged.
  • A null becomes an empty cell, and true and false stay those words.
  • A list of lists becomes rows, its first row the header when it is all text over rows that are not.
  • JSON Lines, one object a line as logs and exports write it, is read line by line.
  • The CSV starts with your region’s separator and a byte order mark, so Excel opens it with every letter right.

How to use it

  1. Paste the JSON into the box, or drop the .json or .jsonl file.
  2. Check the columns, and rename or delete any you do not want.
  3. Save as CSV or Excel, with the separator the reader expects.
  4. Download the file, or copy the CSV.

What it does not do

  • An object keyed by id, such as {"u1": {...}, "u2": {...}}: it becomes one wide row, so put the records in an array first.
  • Arrays spread into rows of their own: a list inside a record stays in one cell as JSON text.
  • JSON with comments or trailing commas: it is refused with the line and column, for the JSON Formatter to repair.

Questions

How are nested objects turned into columns?

Each level adds its key after a dot: {"address": {"city": "London"}} gives a column named address.city. A record without that key leaves the cell empty, so every row has the same columns.

What if the records have different keys?

Every key met in any record becomes a column, in the order first seen. Two records {"name": "Ada", "age": 36} and {"name": "Bo", "phone": "+44"} give three columns, with Ada’s phone and Bo’s age left empty.

Can I turn the CSV back into JSON?

Yes, save as JSON instead, as objects, arrays or JSON Lines. The columns stay flat, though: address.city comes back as one key with a dot in it, not as an object.

Everything here runs in your browser. Nothing you type, paste or open is uploaded, and there is no account and no queue. How that works.

Often used with

More in Converters

  • Unit Converter: Convert length, weight, temperature, volume, area, speed, data size and nine more quantities, both ways, with the formula.
  • Base64 Encode & Decode: Encode text or files to Base64 and decode it back: URL-safe, MIME line breaks, data URIs, and images you can preview.

All toolsAbout utilbrewPrivacy