How to convert CSV to JSON
- Paste your CSV into the box, or open a .csv file. A sample is loaded so you can see the result at once.
- Check the detected delimiter, and say whether the first row is a header.
- Choose the JSON layout and the indent. The result updates as you type.
- Copy the JSON or download it as a file.
Example
id,name,active,city 1,Alex Morgan,true,"Dubai, UAE" 2,Sam Lee,false,London
[
{ "id": 1, "name": "Alex Morgan", "active": true, "city": "Dubai, UAE" },
{ "id": 2, "name": "Sam Lee", "active": false, "city": "London" }
]
JSON layouts
- Array of objects: one object per row, with the header names as keys. The most common layout, and the one that APIs and JavaScript expect.
- Array of arrays: one array per row, with the header as the first row if you want it. Compact, and good for charts and tables.
- Object keyed by a column: the value of one column, such as an id, becomes the key of each row.
- Object of columns: each header holds an array of all values in its column.
Types and empty values
CSV has no types, so every value is text. With type detection on, the converter turns plain numbers into JSON numbers and true and false into booleans, and leaves everything else as text. Values that only look like numbers stay text: a zip code such as 01234, a phone number such as +971 4 000 0000, and any number with more than 15 digits, which a JSON number cannot hold exactly. Empty cells can become an empty string, null, or be left out of the object.
Nested keys
Tick the nested keys option and a header such as address.city creates an object, { "address": { "city": "Dubai" } }. This is the reverse of flattening, which the JSON to CSV converter does.
What it handles correctly
- Fields in double quotes that contain commas, quotes (written as two quotes) and line breaks.
- Comma, semicolon, tab and pipe delimiters, and the byte order mark that Excel adds to UTF-8 files.
- Windows, Unix and old Mac line endings.
- Duplicate and empty headers, which are made unique, and rows with too few or too many columns, which are reported.
Private and free
The conversion runs in your browser. Your data is not uploaded, and there is no limit and no sign up.
To go back, use JSON to CSV. For array output, wrappers and JSON Lines, see CSV to JSON array. For files and a table preview, see CSV to JSON online, and read the CSV vs JSON guide to choose a format. You may also need the YAML to JSON converter, the JSON to XML converter or the JSON diff tool.