How to convert JSON to CSV
To convert JSON to CSV, the JSON has to be a list of objects, like the records an API sends back: each object becomes a row and each key becomes a column. Open or paste it in Olbo's JSON tool and press Save as CSV, under Tables in the Details panel. The tool makes the CSV on your computer and never uploads the JSON.
Step by step
- Open the JSON file, or paste the JSON in.Press Open a JSON file, or press "or paste some JSON" and paste into the box. The top of it should be a list of objects, such as [{"name": "Ann"}, {"name": "Bo"}].
- Find Tables in the Details panel.On a wide screen the panel is open beside the tree unless you have hidden it. Otherwise press Details, or on a phone press the three-dot button and then Details.
- Press Save as CSV.Olbo names the CSV after your JSON, so orders.json becomes orders.csv. If the JSON cannot be a table, Olbo says why at the top of the panel instead.
What happens to nested JSON in the CSV
Olbo does not split a nested object into more columns. An object or a list inside a record goes into one cell as JSON text, so an address comes out as {"city":"Leeds"} and a list of tags as ["red","blue"]. Nothing inside it is lost, but it all stays in that one cell.
Every key that appears in any of the objects gets a column, so a field that only some records have is kept, and the others get an empty cell there. A null becomes an empty cell too, and true and false are written as the words true and false. Olbo puts a value with a comma, a quote or a line break in it inside quotes, so it stays in one cell.
When the JSON is not a list of objects
Many API responses put the list inside an object, as in {"data": [...]}. Olbo then says "The top of this is an object, not a list. A table needs a list of objects." Switch to the Text view, delete everything around the list so the text starts with [ and ends with ], and press Save as CSV again. For a very big file the Text view is greyed out, so cut it down in a text editor first.
A list of plain values, such as [1, 2, 3], cannot be a table either, and Olbo names the first item that is not an object, as in "The item at [0] is a number." Olbo reads a file of many objects, one on each line (JSON Lines or NDJSON), as a list, so each object becomes a row.
Long numbers, and getting an Excel file
Numbers too long for a browser to hold exactly, such as 19-digit IDs, would be rounded on the way into the CSV, so Olbo will not write the file and says which numbers would change. Put quotes around them in the Text view so they are kept as text, then press Save as CSV again.
For an Excel workbook rather than a CSV, the Converter turns the same kind of JSON into an .xlsx file. To look at the CSV in Olbo, open it in Sheets.
More guides
Olbo is an office suite that runs in your browser. Your files are read on the machine you are sitting at and are never uploaded. See all the tools.