Formatters
Convert CSV rows to JSON objects
CSV to JSON converter parses the CSV you paste following RFC 4180: the first row becomes the object keys, each following row becomes one JSON object, and quoted fields can contain commas, doubled quotes and line breaks. The delimiter is detected from the first line (comma, semicolon, tab or pipe) and can be set by hand, and values stay strings exactly as written, so 007 is not turned into 7. Untick "First row is the header" to get an array of arrays instead.
How to use CSV to JSON
- Open CSV to JSON in the Toolbox101 app.
- Paste the CSV into the
CSVbox, header row first. - Leave
DelimiteronDetect, or choose comma, semicolon, tab or pipe if detection guesses wrong. - Read the array of objects in the
Outputbox. UntickFirst row is the headerif the file has no header. - Click
Copyto take the JSON.
Worked example
CSV to JSON returns the output below for this input.
Input
name,role,city
Ada Lovelace,Engineer,London
Alan Turing,Researcher,ManchesterOutput
[
{
"name": "Ada Lovelace",
"role": "Engineer",
"city": "London"
},
{
"name": "Alan Turing",
"role": "Researcher",
"city": "Manchester"
}
]Check it yourself: open CSV to JSON and enter the same input.
Frequently asked questions
What if a CSV field contains a comma or quotes?
It works as the CSV format says: wrap the field in double quotes, and write a literal quote as two. "Smith, John" is one cell, and a quoted field can even span several lines. An opening quote that is never closed is reported as an error.
What happens to empty cells and short rows?
An empty cell becomes an empty string, such as "city": "", and a row with fewer cells than the header is padded with empty strings. A row with more cells than the header gets extra keys named column_4 and so on. Blank lines are skipped.
What if my CSV has no header row?
Untick First row is the header and the output is an array of arrays, one per row, instead of objects. With the box ticked the first row supplies the keys: repeated names get a _2, _3 suffix, and an empty name becomes column.
Are numbers and booleans converted?
No. Every value stays a string, exactly as it appears in the CSV, because a CSV cell carries no type: 007, 1e3 and true are all kept as written. Convert them in your own code, where you know which columns are numeric.