Tool 020 / dev / free / runs locally
CSV to JSON Converter
Paste CSV to get a JSON array of objects using the first row as keys, or paste a JSON array to get a CSV file back. Parsing and conversion happen entirely in your browser, so spreadsheets and API payloads never leave your device. Handles quoted fields, embedded commas, and quoted newlines.
[
{
"name": "Ada Lovelace",
"role": "Engineer",
"years": 2
},
{
"name": "Grace Hopper",
"role": "Admiral",
"years": 44
}
]How it works
This converter goes both ways between CSV and JSON without uploading anything. In CSV to JSON mode it parses your text with a hand-written RFC-4180 parser, takes the first row as the property names, and returns a JSON array with one object per data row. In JSON to CSV mode it takes an array of flat objects and writes a header row from the union of every key it sees, so objects with different keys still line up in the same table.
The parser honours real CSV quoting rather than splitting on every comma: a field wrapped in double quotes may contain commas, line breaks, or escaped quotes written as two double quotes in a row. That is the difference between an address column that survives the round trip and one that shifts every later column by one. On the way back out, any value containing a comma, a quote, or a newline is re-quoted automatically.
Detect numbers is on by default and converts cells that look purely numeric into real JSON numbers. Turn it off when your data has identifiers, postcodes, or phone numbers where the leading zeros matter. Because both directions run in the tab, you can paste a production export or a customer list here without it touching a server.
How to use it
- Pick a direction: CSV to JSON, or JSON to CSV.
- Paste your data into the input box on the left.
- For CSV to JSON, tick or untick Detect numbers depending on whether numeric-looking cells should stay strings.
- Read the converted output on the right, then Copy it or Download it as converted.json or converted.csv.
- Use Swap and use output as input to run the conversion back the other way and check it round-trips.
Worked examples
Input: name,role,years Ada Lovelace,Engineer,2 "Hopper, Grace",Admiral,44
Output: [ { "name": "Ada Lovelace", "role": "Engineer", "years": 2 }, { "name": "Hopper, Grace", "role": "Admiral", "years": 44 } ]
The quoted field keeps its internal comma, and Detect numbers turns the years column into JSON numbers.
Input: [{"sku": "A1", "price": 9.5}, {"sku": "B2", "note": "two, please"}]
Output: sku,price,note A1,9.5, B2,,"two, please"
The header is the union of keys across all objects; a missing key becomes an empty cell and the comma in a value forces quoting.
Edge cases and limits
- The comma is the only supported delimiter. Semicolon files, which Excel produces in several European locales, and tab-separated files are not parsed.
- JSON to CSV requires a top-level array of flat objects. A single object, or an array of arrays, is rejected with an error.
- Nested objects and arrays inside a row are written into the CSV cell as JSON text rather than being flattened into extra columns.
- Duplicate header names collapse: two columns called name produce one property, and the rightmost value wins.
- Detect numbers uses a plain numeric test, so an identifier like 007 becomes 7 and a very long numeric ID can lose precision as a JavaScript number.
- A header cell left blank is given a generated name of the form column_2 so the JSON stays valid.
- Rows where every cell is empty are skipped rather than becoming empty objects.
Common mistakes
- Leaving Detect numbers on for postcodes, SKUs, or phone numbers, then wondering where the leading zeros went.
- Pasting a semicolon-separated export from a European Excel and reading the result as a broken parser rather than a different delimiter.
- Pasting a single JSON object instead of an array. Wrap it in square brackets first.
- Expecting deeply nested API JSON to become a tidy spreadsheet. Flatten the shape you want before converting.
Frequently asked questions
How does the converter handle commas inside a CSV field?+
Standard CSV quoting is supported: wrap a field in double quotes and it can contain commas, newlines, or quote characters (escaped as two double quotes). The parser follows this quoting rule rather than just splitting on every comma, so addresses and free-text fields convert correctly.
What JSON shape does CSV to JSON produce?+
An array of objects, one per data row, using the first CSV row as property names. Every value is kept as a string by default so leading zeros in codes like "007" are preserved; toggle "detect numbers" to convert numeric-looking cells to JSON numbers.
Can I convert JSON back to CSV?+
Yes. Paste a JSON array of flat objects and switch direction to get a CSV file with a header row built from the union of all object keys. Missing keys in a given object become empty cells in that row.
Is my CSV uploaded anywhere when I convert it?+
No. Both the CSV parser and the JSON writer run in your browser tab, and the Download button builds the file from memory with a blob URL. Nothing is transmitted, which is why customer exports and internal data are safe to paste here.
Why did my CSV columns shift after a field with a comma in it?+
That happens when the field was not quoted in the source file. CSV only allows a comma inside a value if the whole value is wrapped in double quotes. Re-export with quoting enabled, and this parser will read it correctly.
Related tools
More Developer tools that run entirely in your browser.