IT Tool

CSV to JSON Converter

Convert CSV to JSON and JSON arrays back to CSV with a proper RFC 4180 parser that handles quoted commas, doubled-quote escapes, and multi-line fields.

Instant 100% Client-Side No Login
PROCESSINGLOCAL
LIMITNONE
PRIVACYBROWSER-ONLY
CSVJSON

Input (CSV)

Output (JSON)

CSV and JSON solve the same problem from opposite ends

CSV, defined by RFC 4180 in 2005, is a flat grid: one header row names the columns, and every line below is a record whose fields line up by position. JSON, defined by RFC 8259 in 2017, is a tree — an array of objects where each value is reached by name rather than by column index. Moving data between them is the everyday work of exporting a Google Sheets or Microsoft Excel table into an API payload, or flattening an API response into something a spreadsheet can open. This converter runs both directions in your browser, and the interesting part is not the happy path but the four edge cases that a naive split-on-comma parser gets wrong.

The three traps that break a split-on-comma parser

The first trap is the comma inside a value. RFC 4180 says any field containing a comma, a double quote, or a line break must be wrapped in double quotes. So "New York, USA" is one field, not two, and a parser that splits the line on every comma shifts every column after it by one.

The second trap is the double quote inside a quoted field. RFC 4180 escapes it by doubling, so the six characters say ""hi"" become the five characters say "hi" after parsing. A parser that merely toggles a quote flag on each " silently deletes both quote marks and produces say hi, corrupting the value with no error at all.

The third trap is the newline inside a quoted field. Because a quoted value may legally contain a line break, you cannot split the file into rows before parsing — the moment you call split on the newline character you have already cut a two-line address field into two broken records. A correct reader walks the raw text one character at a time, tracking whether it is currently inside quotes, and treats a comma or newline as a delimiter only when it is outside them.

What this parser actually does

This tool uses that state machine. It reads the input character by character, folds the two-byte CRLF line ending down to a single newline, strips a leading UTF-8 byte-order mark if your spreadsheet added one, and honors the doubled-quote escape so an embedded quote survives the round trip. The first parsed row becomes the JSON keys; each following row becomes one object. Fields are kept verbatim aside from trimming the header names, so a value like 007 or a leading-zero ZIP code is preserved as text rather than being mangled into the number 7.

Why JSON→CSV unions every key

A JSON object is an unordered set of keys, and two objects in the same array can carry different keys. A converter that reads headers from only the first object — a common shortcut — drops every field that appears later but not first. If object one has name and email and object two adds a phone key, first-object headers throw the phone column away. This tool instead scans all objects and takes the union of their keys, in first-seen order, so no field is lost and every row aligns under a stable header. Values are quoted only when they contain one of the three special characters — comma, quote, or newline.

Nesting, types, and the honest limits

Nesting is the honest limit of any CSV export. CSV is two-dimensional: rows and columns, nothing deeper. JSON is a tree with no fixed depth. When a value in your JSON is itself an object or an array, there is no single column that can hold it faithfully. This converter does not silently render such a value as the useless string [object Object]; instead it serializes the nested structure back to compact JSON and places that text in the cell, so the information survives and you decide how to flatten it. If you need true flattening — turning user.address.zip into its own column — that is a schema decision only you can make, because the right shape depends on your downstream table.

Two boundaries are worth stating plainly. This is a line-and-field converter, not a type inference engine: everything coming out of CSV is a string, because CSV has no way to distinguish the number 30 from the text "30", and guessing wrong is worse than staying consistent. And the array passed to JSON→CSV must be a flat list of objects; a bare value, a lone number, or a deeply nested document raises a clear error rather than producing a misleading half-table. Within those limits the conversion is exact and reversible, and because every byte is parsed on your own machine, nothing you paste is uploaded anywhere.

How to Use

1

Choose CSV→JSON or JSON→CSV with the swap button.

2

Paste your data into the input panel.

3

Click Convert to transform it.

4

Copy the result with one click.

Features

RFC 4180 state-machine CSV parser
Handles quoted commas, doubled-quote escapes, and multi-line fields
JSON→CSV unions keys across all objects so no field is dropped
Nested values kept as JSON, never [object Object]
Runs entirely in your browser — nothing is uploaded

Common Questions

About CSV to JSON Converter

Bidirectional CSV ↔ JSON conversion built on an RFC 4180 state-machine parser. Handles quoted commas, doubled-quote escapes, and multi-line fields that split-on-comma parsers corrupt. JSON→CSV unions keys across every object so no field is dropped, and nested values are kept as JSON rather than [object Object].

Also known as: csv to json, convert csv, json to csv, csv to json online, json array to csv, parse csv, rfc 4180 parser, csv with quoted commas, spreadsheet to json, excel csv to json, flatten json to csv, csv converter, json to spreadsheet, convert csv file.

Processing Note

CSV to JSON Converter runs in your browser, so the input you enter is processed locally on this page and is not uploaded to a ToolMintX account.

Tool Limits

IT tools provide quick diagnostics and transformations. They cannot see every private network, deployment setting, proxy, firewall, or production edge case.

Explore More