CSV to JSON Converter
Convert CSV to a JSON array of objects locally: the first row becomes keys, and quoted fields with commas, quotes and newlines inside them are parsed correctly.
Loading calculator…
What this tool does
Convert CSV to a JSON array of objects locally: the first row becomes keys, and quoted fields with commas, quotes and newlines inside them are parsed correctly. All values stay strings — CSV carries no type information, so "12" becomes "12", not 12. Short rows are padded with empty strings; input is capped at 200,000 characters.
How to use the CSV to JSON Converter
- Enter or select csv (first row = headers).
- Read the calculated result; change any measurement to compare alternatives.
Formula
Parse CSV with a quote-aware state machine (a quote starts a field only in field position, "" is an escaped quote); map each row to an object keyed by the header row; serialise with two-space indentation.
- value
- CSV (first row = headers)
All values stay strings — CSV carries no type information, so "12" becomes "12", not 12. Short rows are padded with empty strings; input is capped at 200,000 characters.
Worked example
For csv to json converter, the following measurements illustrate the exact method: CSV (first row = headers): name,role,note Ada,Coach,"Says ""hi, team"" often" Ben,Client,New member.
Inputs
- CSV (first row = headers)name,role,note Ada,Coach,"Says ""hi, team"" often" Ben,Client,New member
Result
- JSON[ { "name": "Ada", "role": "Coach", "note": "Says \"hi, team\" often" }, { "name": "Ben", "role": "Client", "note": "New member" } ]
- Rows converted2
- Columns3
Results explained
- JSON
- JSON from the formula above. All values stay strings — CSV carries no type information, so "12" becomes "12", not 12. Short rows are padded with empty strings; input is capped at 200,000 characters.
- Rows converted
- Rows converted from the formula above. All values stay strings — CSV carries no type information, so "12" becomes "12", not 12. Short rows are padded with empty strings; input is capped at 200,000 characters.
- Columns
- Columns from the formula above. All values stay strings — CSV carries no type information, so "12" becomes "12", not 12. Short rows are padded with empty strings; input is capped at 200,000 characters.
Frequently asked questions
Fields wrapped in double quotes may contain commas, quotes (doubled as "") and even newlines; the parser is quote-aware, so "Says ""hi, team""" becomes the single value: Says "hi, team".
CSV has no types — every cell is text. This converter preserves fidelity by keeping values as strings; convert types in code afterwards if you need numbers or booleans.
Missing trailing cells are filled with empty strings so every object has every key. Extra cells beyond the header are ignored.
Yes — the first row supplies the object keys. If your CSV has no header row, add one before converting.
No. Conversion runs entirely in your browser.