How to use the CSV ↔ JSON converter
- Select the direction: CSV → JSON or JSON → CSV.
- Paste your data. For CSV, the first row is treated as the header row and the delimiter is detected automatically.
- Review the output. Enable type conversion if you want numbers and booleans instead of strings.
- Copy the result or paste it into your code, API request or spreadsheet.
All parsing happens in your browser. Your spreadsheet data is not uploaded or stored anywhere, which makes the tool safe for customer lists and internal exports.
How CSV maps to JSON
CSV (comma-separated values) is a flat table: one record per line, fields separated by a delimiter. When a header row is present, each header becomes a key and each subsequent row becomes a JSON object. The whole file becomes an array of objects:
id,name,city
1,Ada,London
2,Linus,Helsinki
[
{"id": "1", "name": "Ada", "city": "London"},
{"id": "2", "name": "Linus", "city": "Helsinki"}
]
Converting JSON back to CSV works in reverse: the converter collects the keys of the objects to form the header row, then writes one line per object. Objects that lack a key get an empty cell.
Delimiter auto-detection
Despite the name, "CSV" files often use other separators. Spreadsheet programs in locales that use a comma as the decimal separator commonly export with semicolons, and many database tools export tab-separated values (TSV). The converter inspects the first lines and picks the delimiter (comma, semicolon, tab or pipe) that splits rows into a consistent number of columns.
Quoted fields (RFC 4180)
RFC 4180 is the closest thing CSV has to a standard. Its key rules: a field containing the delimiter, a double quote or a line break must be wrapped in double quotes, and a double quote inside a quoted field is escaped by doubling it.
name,comment
"Smith, John","He said ""hello"""
"Lee","Line one
Line two"
This produces two records, the first with the name Smith, John and the comment He said "hello", and the second with a comment that contains a real line break.
Common pitfalls
Nested JSON does not fit a flat table
CSV has no concept of nesting. Nested objects are typically flattened with dot notation, but arrays have no single obvious representation:
{"id": 1, "address": {"city": "Oslo", "zip": "0150"}, "tags": ["a", "b"]}
id,address.city,address.zip,tags
1,Oslo,0150,"[""a"",""b""]"
Arrays are serialised as JSON text inside a cell. If your data is deeply nested, consider whether CSV is the right target at all.
Type conversion can destroy data
Every CSV value is text. Automatic type conversion is convenient, but it turns ZIP codes such as 0150 into 150, phone numbers into numbers and long IDs into rounded values (JavaScript numbers are exact only up to 253). Leave type conversion off for identifier columns.
Byte order marks and line endings
Files saved by Excel as "CSV UTF-8" start with an invisible byte order mark (BOM) that can end up glued to the first header name. RFC 4180 specifies CRLF line endings, but LF-only files are common and generally accepted.
Tips
- Make sure header names are unique; duplicate headers overwrite each other as JSON keys.
- Trim spaces after delimiters (
a, b) if your source adds them, or they become part of the value. - Validate the resulting JSON with the JSON formatter, or turn it into YAML with the JSON ↔ YAML converter.
Frequently asked questions
What if my CSV has no header row?
Without headers there are no natural key names. Converters then either output an array of arrays or generate placeholder keys such as column1, column2. Adding a header row first gives cleaner JSON.
Why are all my numbers strings?
CSV stores everything as text, so a faithful conversion keeps strings. Turn on type conversion to get numbers, true/false and null, but be careful with values that only look numeric.
Can I convert a JSON object instead of an array?
A CSV file represents many rows, so the natural input is an array of objects. A single object becomes one data row. If your records are wrapped inside a property such as {"data": [...]}, paste the inner array.
How do I open the CSV in Excel correctly?
Use Excel's data import feature rather than double-clicking, so you can choose the delimiter and encoding and mark ID columns as text to keep leading zeros.