Skip to content
DevTinyTools

CSV to JSON Converter

Paste CSV, get clean JSON. Quoted commas and line breaks are parsed per RFC 4180, dotted headers unflatten into nested objects, and numbers are only converted when the text round-trips exactly.

Runs entirely in your browser — your JSON is never uploaded.

0 chars
0 chars

Free conversion covers up to 1,000,000 characters per document — what Pro adds. The file you open is read locally by your browser; nothing is uploaded.

A worked example

Quoted commas stay inside one cell, and dotted headers become nested objects.

Input

id,user.name,user.role
1,"A, B",admin
2,C,viewer

Output

[
  {"id":1,"user":{"name":"A, B","role":"admin"}},
  {"id":2,"user":{"name":"C","role":"viewer"}}
]

Numbers are converted only when they round-trip exactly, so IDs and leading zeroes are not silently rewritten.

How to convert CSV to JSON

  1. Paste your CSV into the input panel, open a .csv file, or press “Load example” for a file with quoted commas, empty cells and ambiguous numbers.
  2. Check the options Delimiter detection is on by default and handles Excel commas, European semicolons and TSV. Keep “first row is column names” on unless your file starts with data.
  3. Press Convert to JSON Records appear on the right, one object per row. Notes about ragged rows, renamed duplicate headers or the detected delimiter are listed under the output.
  4. Copy or download The output is pretty-printed JSON with two-space indent, ready to paste into a config, an API test or a seed script.

The typing rule: convert only what round-trips

Most converters turn anything numeric into a number, and that is where data gets rewritten without anyone noticing. Three concrete losses:

  • Trailing zeros. The price text 19.50 becomes the number 19.5 — and when it prints again, the zero is gone.
  • Leading zeros. 02134 is a ZIP code, not the number 2134. Converting it breaks the address.
  • Big IDs. Any integer past 253 loses its final digits when stored as a double — the same precision ceiling every JSON number shares.

The rule this tool uses: a cell becomes a number only when String(Number(cell)) is the exact text it started from. Everything else — 19.50, 02134, 19-digit IDs, scientific notation — stays a string, so the JSON you get says what the CSV said.

Booleans follow the same standard: true and false convert; TRUE, yes and 1 do not, because a spreadsheet that stores TRUE as text meant it as text more often than not.

What the parser handles, strictly

  • Quoted everything. Fields may contain the delimiter, doubled quotes and raw line breaks — "Item: keyboard, USB" stays one cell.
  • Delimiter detection. Counts separators outside quotes, so semicolon files whose quoted cells contain commas are not misread.
  • Unclosed quotes fail loudly. A missing closing quote is reported as an error rather than absorbed into one giant cell — the failure mode that makes other converters lose half a file silently.
  • Ragged rows are padded, with a warning. Missing cells become null and surplus cells are dropped; the notes panel tells you it happened instead of letting the shape shift quietly.

Round-tripping with the JSON to CSV tool

The two converters on this site are designed as a pair. JSON to CSV flattens nested objects into dotted columns, writes null as an empty cell and prints numbers exactly. This tool reverses all three: dotted headers unflatten back into objects, empty cells become null, and the exactness rule accepts the numbers it produced.

The round trip is not universal — arrays inside rows travelled as JSON text in one cell, so they come back as strings. For flat-and-nested objects without arrays, what goes in is what comes out, cell for cell. The losses that survive a spreadsheet — rounded IDs, eaten leading zeros — are collected in Converting JSON to CSV: what breaks on the way.

DevTinyTools Pro

The free converter handles the payloads most people paste by hand. Pro raises the document cap and unlocks every other tool on the site:

  • 10,000,000-character documents, roughly 10 MB of CSV
  • The same Pro licence unlocks every tool on the site — conversion, diffing, type generation and batch ZIP export
  • Priority fixes — conversion bugs move to the front of the queue

Pro is $29 one-time — a lifetime licence, sold through Lemon Squeezy as merchant of record, so VAT and sales tax are handled for you. Pro is a licence key — there is still no account. Buy DevTinyTools Pro, then activate it below and the higher limits unlock in this browser.

Frequently asked questions

Which CSV dialects does this parse?
RFC 4180, which covers what Excel, Google Sheets and every mainstream exporter produce: quoted fields may contain the delimiter, doubled quotes and line breaks, and rows can end with CRLF or LF. An unclosed quote is reported as an error instead of silently swallowing the rest of the file.
How does delimiter detection work?
It counts commas, semicolons and tabs outside quoted fields and uses whichever appears most. A European export where quoted cells contain commas but semicolons separate fields is detected correctly. You can override it manually if a file has no separators at all.
Why did 19.50 stay a string?
Because JSON has no way to write 19.50 without rewriting it: the number 19.5 prints as 19.5, and the trailing zero — which may be meaningful in a price list — is gone. The tool converts a cell only when the value round-trips to the exact same text, so 19.5 becomes a number but 19.50 and 15-digit IDs stay strings. Turn off the inference checkbox to keep everything as text.
What do empty cells become?
null, when type inference is on. That matches the JSON-to-CSV direction on this site, where null is written as an empty cell, so a JSON → CSV → JSON round trip comes back unchanged. With inference off, empty cells stay as empty strings.
What happens to dotted header names?
With unflattening enabled, customer.name becomes a nested object: {"customer": {"name": …}}. That is the inverse of the flattening the JSON-to-CSV tool applies, so files it produced convert back to their original shape. Disable the checkbox to keep every header as a literal flat key.
What happens when rows have different column counts?
Short rows are padded with null and surplus cells are dropped, and a warning names the situation — nothing fails and nothing is silently reshaped. Ragged rows are common in hand-maintained spreadsheets and usually mean a formula stopped copying.
How are duplicate header names handled?
The second occurrence is renamed with a numeric suffix (id and id_2), because JSON objects cannot hold duplicate keys — the second would silently overwrite the first. Empty header cells become column1, column2 and so on.
Is my CSV uploaded anywhere?
No. Parsing, type inference and serialisation all happen in the tab with browser APIs, and the file picker uses FileReader. You can confirm that in the network panel: no request is made during a conversion.
JSON RepairFix broken JSON from an assistant or a config file: fences, comments, single quotes, trailing commas, Python literals and truncated tails — with every change reported.JSON Formatter & ValidatorPretty-print JSON with 2 or 4 space indentation, check the syntax and copy or download the result.JSON ValidatorCheck whether a JSON document is valid and see exactly where the parser stopped.JSON MinifierStrip whitespace from JSON and see how many bytes the minified output saves.JSON Diff CheckerCompare two documents and list every added, removed and changed value with its path.JSON Escape & UnescapeTurn raw text into a JSON string value, or decode backslashes and \u escapes back into readable text.JSON to CSV ConverterTurn an array of JSON objects into a CSV file you can open in a spreadsheet.JSON to TypeScript GeneratorGenerate TypeScript interfaces from a JSON sample, with optional properties and unions inferred from every array element.JSON to Go Struct GeneratorGenerate Go structs from a JSON sample, with json tags, int64 or float64 widths, pointers for null fields and omitempty for optional keys.JSON to Java POJO GeneratorGenerate Java classes from JSON: primitives for required values, boxed types for optional and nullable ones, @JsonProperty for renamed keys and nested static classes.JSON to YAML Converter (and back)Convert JSON to YAML or YAML to JSON in both directions, with multi-document support, error line numbers and YAML 1.2 typing rules.JSON to Python Class GeneratorGenerate Pydantic v2 models or dataclasses from JSON, with snake_case fields, Optional where a key is missing or null, and keyword keys renamed safely.JSON to C# Class GeneratorGenerate C# classes from JSON with nullable annotations taken from every record, initialisers that avoid CS8618 and [JsonPropertyName] for each wire key.JSON to JSON Schema GeneratorTurn a JSON sample into a draft 2020-12 schema: required keys, nullable unions and nested $defs.