Docs/Open, save and CSV
JSON to CSV: export and import data
Bring JSON in from a file, a web address, the clipboard or a drag and drop; save it as a .json file; convert JSON to CSV and CSV back to JSON.
Open and save
- Press the Open file button in a panel’s toolbar, or press Ctrl+O, and pick a .json, .ndjson, .txt or .csv file. It opens in that panel.
- Or drop a file onto a panel: it opens in that panel. Dropped text is treated as a paste.
- Or press the Open from URL button (Ctrl+Alt+O) and type the address of a JSON or CSV file.
- Press the Save .json button (Ctrl+S) to download the panel’s document under the file name shown in its status bar.
Keys
Paste
In text mode, paste works like any editor. In tree or table mode, pasting with a row selected replaces that value (text that isn’t JSON becomes a string); with nothing selected it replaces the whole document.
The Paste button reads the clipboard if your browser allows it; if not, use Ctrl+V inside the panel. The New document button empties the panel; Undo brings the old document back.
From a web address
Your browser fetches the address directly. Nothing else is sent: no cookies, no referrer, no copy of your documents.
The server has to allow other sites to read the file (CORS). If it doesn’t, JSON Editor Free says so; download the file and open it from disk instead.
CSV
The Export CSV button (Ctrl+Shift+S) writes the array of objects in the panel (the one the table shows, or the selected array) with one column per field. Nested fields become columns such as address/city.
The Import CSV button (Ctrl+Shift+O) reads a CSV file with a header row. Numbers, true, false and empty cells (as null) are read as JSON values, and address/city columns rebuild nested objects. A text cell that looks like a number comes back as a number.
Convert JSON to CSV, step by step
Open or paste a JSON array of objects, such as a list of users from an API. To convert only part of a larger document, select that array in tree mode first, or show it in table mode.
Press Export CSV or Ctrl+Shift+S. JSON Editor Free downloads a .csv file named after the document and says “Exported” with its name. The conversion runs in your browser, so the data is not uploaded.
For example, the JSON [{"name": "Ada", "address": {"city": "London"}, "tags": ["math", "code"]}, {"name": "Alan", "address": {"city": "Wilmslow"}}] becomes this CSV:
name,address/city,tagsAda,London,"[""math"",""code""]"Alan,Wilmslow,
Export data from JSON
To export data from JSON to a spreadsheet, you usually want one list inside it: the users, orders or products an API returned. You don’t have to cut that list out by hand. Open or paste the whole response and press Export CSV (Ctrl+Shift+S): with nothing selected, it exports the array that table mode shows. When the document holds several arrays, pick one in the menu above the table, or select it in tree mode first.
For example, the API response {"page": 1, "users": [{"id": 1, "name": "Ada", "plan": "pro"}, {"id": 2, "name": "Alan", "plan": "free"}]} exports its users array as this CSV, ready for a spreadsheet:
id,name,plan1,Ada,pro2,Alan,free
Export only the data you need
- Some fields or rows: run a query first in Query and transform JSON, for example to keep the paying users and only their names, then export the result. One Undo brings the full list back.
- In a set order: sort the array by a field with Sort JSON keys and arrays, and the CSV rows come out in that order.
- As JSON: press Save .json (Ctrl+S) to download the panel’s document as a .json file instead.
- Privately: the export runs in your browser, so the data you export is not uploaded.
Convert CSV to JSON: an example
To import a CSV file as JSON, press Import CSV (Ctrl+Shift+O) and pick a file with a header row, or open the .csv file with Open file. Each row becomes one object in a JSON array, and each header becomes a key. The file is read in your browser, so it is not uploaded.
For example, the CSV below imports as [{"id": 1, "name": "Ada", "active": true, "address": {"city": "London"}}, {"id": 2, "name": "Alan", "active": false, "address": {"city": null}}]. The ids and true/false cells become JSON numbers and booleans, the address/city column becomes a nested address object, and Alan’s empty city becomes null. Check the result in table mode or validate it against a JSON Schema.
id,name,active,address/city1,Ada,true,London2,Alan,false,
How JSON becomes CSV and back
- Columns: one for every field found in any item, in the order they first appear. An item without a field gets an empty cell.
- Nested objects: each nested field becomes its own column, named by its path, such as
address/city. Importing that column rebuilds the nested object. - Arrays: an array inside an item stays in one cell as compact JSON, and comes back as an array when you import the CSV.
- Quotes: a cell holding a comma, a double quote or a line break is wrapped in double quotes, with quotes doubled, as spreadsheet programs expect.
- Round trip: an empty cell comes back as null, so a missing field returns as a field set to null.
- Before you export: pick or rename fields with a query in transform, check the rows in table mode, and use large documents for files over 100 MB.