Skip to the tool

JSON and CSV converter

MDV Tools

Paste JSON or CSV on either side; the other side follows, as CSV or TSV.

Runs on this device Works offline
JSON to CSV
paste json or csv above
How this works

JSON to CSV. The JSON is read with the browser's JSON.parse, whose error position the page turns into a line and column. An array of objects becomes one row per object; a single object becomes one row; an array of arrays is written row for row; an array of plain values becomes one column called value. The columns are every key that appears in any row, in the order they first appear, so a key missing from one object leaves that cell empty. A nested object is spread into dotted columns — {"notes":{"page":83}} becomes a notes.page column — and an array inside a row is written as its JSON text in one cell. null is an empty cell. A field is put in double quotes when it holds the separator, a quote, a line break, or space at either end, and a quote inside is doubled, as RFC 4180 sets out. Lines end in LF in the box; Download writes CRLF and starts the file with a UTF-8 byte order mark, so Excel reads accents correctly. TSV has no quoting standard, so when a TSV cell needs quotes the page says so.

CSV to JSON. A parser in this page reads RFC 4180: fields in double quotes can hold the separator, doubled quotes and line breaks, and lines may end in CRLF, LF or CR. A quote in the middle of an unquoted field, or a quoted field that never closes, stops the reading with the line and column. When the first line holds none of the chosen separator but does hold another, the page switches to it and says so. With First row names the columns, each row becomes an object keyed by the header; an empty name becomes column_3, a repeated name gets _2, a row with fewer fields fills the rest with empty strings, a longer row puts the extras under _6 and so on, and dotted names such as notes.page are nested back into objects. Without it, the result is an array of arrays.

Read numbers and true/false turns a cell into a number only when it is written the way JSON writes numbers and comes back with the same digits — 42, -3.5, 1e3 — so 02134, 1,5 and 12345678901234567890 stay text. true, false and null become those values, and a cell that starts with [ or { and parses as JSON becomes that array or object, which is how arrays make the round trip. Unticked, every cell stays a string.

A spreadsheet can treat a cell that starts with =, +, - or @ as a formula; the page does not alter such cells, so open CSV from a source you do not trust with care. Each box takes up to 5,000,000 characters, and a result that would pass that is refused. Nothing is uploaded: there is no server in this file, and neither box is stored.

The Dark button remembers its setting in this browser's local storage. Nothing you type or drop into the page is stored.