CSV to JSON Converter
Convert CSV spreadsheet data to a JSON array of objects. Header-row column names, RFC 4180 quote handling, type-safe by default (all strings).
About CSV → JSON
CSV-to-JSON conversion takes a CSV with a header row and produces an array of objects where each row becomes one object. Column headers become object keys; values become object values. The parser handles RFC 4180 quoting (commas inside quoted cells, double-quote escaping, multi-line quoted values), trims whitespace, and preserves the column order via JavaScript object-key insertion order. Typical use cases: importing a spreadsheet into a codebase as a fixture; converting Excel export data for a REST API that expects JSON; loading a lookup table into JavaScript without having to hand-transform; prepping data for a JSON-based ETL pipeline from legacy CSV sources. By default all values are strings — "42" stays as "42", "true" stays as "true". This is deliberately lossless; coercing "42" to a number silently changes the type of a ZIP code column (where "01234" would become 1234) and can't be reversed. If your downstream code needs typed values, post-process each column explicitly — cast ZIP codes to string, parse prices to float, parse dates to Date. The manual step is short, the silent-coercion bugs aren't.
Features
- Convert JSON arrays to CSV spreadsheet format
- Convert CSV data back to JSON format
- Handle nested objects and complex data structures
- Download converted data as a file
How to Use
- Paste your JSON or CSV data into the input field
- Select the conversion direction (JSON to CSV or CSV to JSON)
- View the converted output instantly
- Copy or download the result
Frequently Asked Questions
Why are my numbers kept as strings?
Deliberate — auto-coercing "42" to a number would corrupt ZIP codes ("01234" → 1234), phone numbers, and any fields where leading zeros matter. The converter returns every value as a string; you cast in your downstream code where you know each column's intended type.
What does the converter do with empty cells?
Empty string. `name,email\nAda,` produces `[{"name": "Ada", "email": ""}]`, not null. If you need nulls for absent values, post-process: `data.map(r => ({ ...r, email: r.email || null }))`.
How does it handle multi-line values?
RFC 4180 allows newlines inside double-quoted cells. The parser recognises `"line one\nline two"` as a single field. Make sure your source actually emits quoted multi-lines — some CSV exporters break the spec and use \r\n as a field separator inside unquoted text, which ruins parsing.
Will the output preserve column order?
Yes — JavaScript objects preserve insertion order, so the JSON stringified output lists keys in the same order as the CSV's header row. JSON specs don't require this, but every mainstream parser has behaved this way for years. Safe to rely on for display and round-tripping.