CSV ↔ JSON Converter
Convert between CSV and JSON directly in your browser.
[
{
"name": "Ada Lovelace",
"role": "Engineer",
"city": "London"
},
{
"name": "Grace Hopper",
"role": "Admiral",
"city": "New York"
}
]How it works
Converting CSV to JSON treats the first row as the header and turns every following row into an object whose keys come from that header. Rows shorter than the header are padded with empty strings, so the result is always a rectangular array of objects.
The parser follows the usual CSV conventions rather than splitting on commas: quoted fields may contain commas and newlines, a doubled quote inside a quoted field means a literal quote, and both LF and CRLF line endings are accepted.
The reverse direction expects an array of objects. The header is the union of every key that appears, so objects with different shapes still line up; missing values become empty fields, and nested objects and arrays are written as JSON inside the cell.
Frequently asked questions
- How are commas inside a CSV field handled?
- A field containing a comma, a quote, or a newline is wrapped in double quotes, and quotes inside it are doubled. The parser reads that convention on the way in and applies it again on the way out.
- Why does my JSON fail to convert to CSV?
- CSV is a table, so the input has to be an array of objects. A single object, an array of arrays, or an array of strings has no rows and columns to map and is rejected with an explicit message.
- What happens to nested objects and arrays?
- They are written into the cell as JSON text, since CSV has no notion of nesting. Flatten them first if the target system needs one column per field.
- Are all values treated as strings?
- Going from CSV to JSON, yes. CSV carries no types, so numbers and booleans come out as quoted strings rather than being guessed at, which avoids mangling identifiers with leading zeros.
- Does it support semicolon-separated files?
- Not directly. The delimiter is the comma, as the format's name implies. Replace semicolons with commas first if your export used the European convention.