1
OneClickUse
Converters Tool

CSV to JSON

Convert simple CSV rows into JSON objects using the first row as headers.

Privacy-first workflows
Fast and simple
100% Free, no signup

Written by Anil Gautam · Updated

How does CSV to JSON turn rows into objects?

The first line supplies the keys, and every later non-empty line becomes one object in a JSON array. Lines are split at every comma, and spaces around headers and values are trimmed. Take a header line name,city,score followed by the rows Asha,Pune,91 and Ravi,Delhi. The output holds two objects: Asha's has all three keys with score set to "91", and Ravi's has only name and city, since his line stops after two values. Indentation is two spaces.

Every value stays a string. Values such as true and null come out as the strings "true" and "null", and leading zeros in phone numbers and IDs such as 007 stay intact. Convert numbers in your own code if it expects them. A row with more values than headers gets extra keys named by position, such as col4 for a fourth value, and when two headers share a name, the later column overwrites the earlier one. Without a header line, your first record turns into the keys and drops out of the data.

Why does my CSV split into the wrong columns?

The splitter ignores quotes. In the line Asha,"Pune, MH",91 the comma inside the quotes is treated as a separator, so city becomes "Pune with a stray quote mark, score becomes MH" and 91 moves to a new key, col4. Excel and Google Sheets put quotes around any exported cell that contains a comma, so addresses and names written as Last, First are the usual cause.

Other separators fail without any warning. A semicolon-separated file, common in regions that write decimals with a comma, turns each whole line into one value under a single long key such as "a;b;c". Tab-separated text behaves the same way. If no value contains a comma, Find and Replace can change every ; to a comma before you convert.

How are line endings and blank lines handled?

Windows line endings (CRLF) are handled, so text copied from a CSV saved on Windows splits into the right rows. Empty lines are skipped, while a line holding only spaces becomes an object with an empty first value, so delete stray whitespace lines before you convert.

Is my CSV uploaded anywhere?

The conversion runs in your browser, so customer lists and exported records are not sent to a server. For the reverse trip, JSON to CSV builds a header from object keys. Remove Duplicate Lines can clear repeated rows before you convert, and JSON Minifier squeezes the output onto one line when you need to paste it into code.

How it works

How to convert CSV to JSON

STEP 01
Paste CSV with a header row.
STEP 02
Review the generated JSON array.
STEP 03
Copy the JSON output.
You might also need

Related tools

Converters
SQL Formatter & Beautifier
Format messy SQL into clean, readable queries — or minify for embedding.
Use now
Converters
HTML Minifier & Beautifier
Minify HTML for production or beautify ugly HTML for reading.
Use now
Converters
CSS Minifier & Beautifier
Minify CSS to ship smaller stylesheets or beautify for reading.
Use now
Converters
JavaScript Minifier & Beautifier
Minify or beautify JavaScript for production or debugging.
Use now
Converters
Markdown to HTML Converter
Convert Markdown to clean HTML with live preview.
Use now
Converters
HTML to Markdown Converter
Strip HTML to clean Markdown — useful for moving content into docs or static sites.
Use now
FAQ

Common questions