CSV to JSON
Convert CSV.
Loading tool…
What is CSV, and why is it harder than it looks?
CSV means comma-separated values: one record per line, fields separated by commas. It is the oldest and most widely supported data interchange format there is, and it was standardised only loosely, which is where the difficulty comes from. Fields containing a comma must be quoted. Quotes inside a quoted field are escaped by doubling them. Records may contain line breaks inside quotes. And many European exports use semicolons instead of commas because the comma is their decimal separator.
Converting to JSON means parsing all of that correctly, then deciding what the data means: the first row is normally a header supplying the keys, and every subsequent row becomes an object. Types are the other decision — CSV has none, so 42 and true arrive as strings unless the converter infers otherwise, and leading zeros in things like postcodes must be preserved rather than silently turned into numbers.
Why we built this tool
The typical job is feeding a spreadsheet export into something that speaks JSON: seeding a database, driving a test fixture, posting records to an API, or loading data into a JavaScript front end.
Those exports are usually the real thing — customer lists, order histories, employee records. Uploading them to a converter site is a data transfer you would struggle to justify in a privacy review. Our parser runs in your browser, so the file is read from disk into the tab, converted with your own CPU, and written back out. Nothing is transmitted, there is no row cap, and large files are limited only by your device's memory rather than someone else's upload policy.
Tips and common mistakes
- Check the delimiter before converting; European exports frequently use semicolons.
- Postcodes, phone numbers, and account references should stay strings — automatic number detection strips their leading zeros.
- A header row with duplicate or blank column names produces confusing keys, so tidy it first.
- Fields containing commas must be quoted in the source; unquoted ones will split into extra columns.
Open CSV to JSON with a link
Assistants and scripts can open CSV to JSON with its input already in the link, after the #, which never leaves your device:
#text=— the text to work on
Example: https://mygadgets.ink/tools/csv-to-json/#text=... · also compressed gz fields and ?url=. How tool links work
Quick start: using CSV to JSON
- Paste your CSV or load the file above.
- Confirm the delimiter — comma or semicolon — and whether the first row is a header.
- Run the conversion and inspect the first object in the output.
- Check that numeric and boolean-looking fields have the types you want.
- Copy the JSON or download it for use in your project.
Going the other way is JSON to CSV, and JSON Formatter will pretty-print the result.
How the conversion maps
A CSV becomes a JSON array where each row is an object. The header row supplies the keys, and each subsequent row supplies the values. A CSV with columns name,email,age and a row Ada,ada@x.com,36 becomes an object with name, email, and age fields. The result is a clean list of records ready for a program to loop over.
The details that break conversions
CSV looks simple but hides sharp edges:
- Commas inside values. A field like
"Smith, Ada"must be quoted, or the comma splits it into two columns. Properly quoted CSV handles this; malformed CSV does not. - Headers are essential. Without a header row, there are no keys — the converter cannot name the fields meaningfully.
- Everything is text. CSV has no types, so
36andtruearrive as strings. You may need to convert numeric or boolean fields afterward depending on what your code expects. - Empty cells become empty strings or nulls — decide which your data needs.
- Inconsistent rows — a row with fewer columns than the header — produce missing or misaligned fields.
Validate the result
After converting, it is worth checking the JSON is well-formed, especially if the CSV was messy. JSON Validator confirms correctness, and JSON Formatter makes the output readable so you can eyeball whether the mapping came out right.
Common uses
- Feed spreadsheet data into a web app or API.
- Turn an export into a config or seed file.
- Prepare test data from a CSV.