Convert CSV to JSON without losing field values
To convert CSV to JSON, use a header row with a unique name for each column and keep the same number of fields in every record. DataLens maps headers to object keys and preserves CSV values as strings, including leading zeroes. Quoted commas and quoted line breaks stay inside their fields.
Open CSV to JSON converterHow CSV headers become JSON keys
Choose CSV → JSON, paste the source and select Convert to JSON. The first row supplies the property names, and every later record becomes an object in an array. Inspect the output, then copy it or download the .json file.
The converter keeps field values as strings instead of guessing their types. This preserves identifiers such as 0012. A value spelled false remains the string "false", not a JSON boolean. Convert selected fields deliberately in your application if it requires numbers or booleans.
id,name,city
0012,Alex,"New York, NY"
0013,Sam,London[
{"id":"0012","name":"Alex","city":"New York, NY"},
{"id":"0013","name":"Sam","city":"London"}
]Why splitting on every comma breaks CSV
CSV fields can contain the delimiter itself. A double-quoted field can also contain a line break, and an embedded double quote is represented by two double quotes. A parser must track quoted fields; a simple split on commas or newlines can turn one record into several broken pieces.
name,note
Alex,"Said ""hello"""{"name":"Alex","note":"Said \"hello\""}Reference: RFC 4180: common CSV quoting conventions.
Fix duplicate headers and inconsistent rows
DataLens rejects duplicate header names because two fields cannot safely map to the same object property. Rename repeated columns before converting. Blank headers receive generated column names, which still need to be unique in the final header set.
A row with too many or too few fields is rejected instead of silently dropping data. Check an unmatched quote, an unquoted delimiter in a value, or an extra delimiter at the end of the row. The delimiter detector supports commas, tabs, pipes and semicolons; inspect a small sample if the source format is unusual.
| Symptom | Check |
|---|---|
| Duplicate header error | Give every column a different name. |
| Unexpected field count | Match each record to the header width and check quoting. |
| An ID is missing leading zeros | Check whether the source spreadsheet changed it before export. |
| A boolean appears in quotes | CSV values intentionally remain strings. |
Convert a JSON array back to CSV
Switch to JSON → CSV and provide an array of objects. The converter uses the union of their property names as headers. Values that contain commas, quotes or line breaks are escaped for CSV. Nested objects and arrays become JSON text inside a cell rather than additional columns.
Review the result in the program that will consume it. If you need one column joined into a single line, use the comma separator instead. If you need to inspect nested structures, keep the JSON and use the formatter or JSONPath tester. Each choice preserves a different part of the original structure.
Try it with your own data
The examples are ready to copy. Open the csv to json converter to inspect your input and review the result.
Open CSV to JSON converter