CSV to JSON Converter
Paste CSV and get an array of JSON objects, or an array of arrays if there is no header.
INPUT
CHARS: 0WORDS: 0LINES: 0
OUTPUT
CHARS: 0WORDS: 0LINES: 0
How the CSV to JSON Converter works
The parser follows the common CSV rules: fields can be wrapped in double quotes, quoted fields may contain commas and line breaks, and a doubled quote stands for a literal quote. The delimiter can be detected automatically from the first lines or picked from comma, semicolon, tab and pipe.
With the header option on, the first row supplies the key names. Type conversion turns values such as 42, 3.5, true, false and null into real JSON types, while everything else stays a string. Leading zeros are preserved only when conversion is off, since a number like 007 is not valid JSON as a number.
CSV to JSON Converter examples
Sample input with the default options
Input
name,age,active Ada,36,true Linus,54,false
Result
[ { "name": "Ada", "age": 36, "active": true }, { "name": "Linus", "age": 54, "active": false } ]
When it is useful
- •Turning a spreadsheet export into data for a script or API.
- •Preparing seed data for a web app from a CSV.
- •Inspecting the structure of a file before writing an importer.
- •Converting European semicolon separated exports.
Frequently Asked Questions
What if a column has leading zeros, like ZIP codes?
Turn off type conversion so that 02134 stays a string. With conversion on it would become the number 2134.
Can it handle commas inside fields?
Yes, as long as the field is wrapped in double quotes, which is how spreadsheet programs export such values.
How do I convert JSON back to CSV?
This tool goes one way. For tabular output you can paste a spreadsheet selection into the Markdown Table Generator.
Guides that use this tool
Related tools
- JSON Formatter and MinifierPaste JSON to validate it and print it neatly, or compress it to a single line.
- JSON to YAML ConverterSwitch configuration between JSON and YAML in either direction.
- Markdown Table GeneratorPaste cells from Excel, Google Sheets or a CSV and get a ready to use Markdown table.
- List ConverterReshape a list for SQL, code or a spreadsheet.
- Duplicate Line RemoverPaste a list and keep each line once, in the order it first appeared.