Skip to content
Accessibility
Theme
Text size
High contrast
Limit animations
Readable fontAtkinson Hyperlegible
Increased text spacing
Underline links
Always show focus

Runs in your browser — nothing you paste is uploaded.

CSV ↔ JSON

Convert CSV to a JSON array of objects and back. Handles quoted fields, embedded commas and newlines. Runs in your browser.


    

What it does

This converter goes both ways between CSV and a JSON array of objects. CSV → JSON treats the first row as column headers and turns every following row into an object, keyed by those headers. JSON → CSV takes an array of objects and writes a header row followed by one row per object. Switch direction with the toggle at the top; output updates as you type.

How it works

The CSV parser is a proper state machine, not a naive split(","), so it respects RFC 4180 quoting: a field wrapped in double quotes may contain commas and line breaks, and two double quotes in a row ("") represent a single literal quote. Carriage returns are normalised first, so files saved on Windows parse correctly. Going the other way, the writer collects the union of all keys across your objects as the header, then quotes any field that contains a comma, quote or newline. All values are treated as strings — see the gotchas.

Gotchas

  • CSV has no types, so every value round-trips as a JSON string: "42", not 42. Cast afterwards if you need numbers.
  • JSON → CSV expects a top-level array of objects. A bare object or a nested structure throws an error shown with a ⚠.
  • Nested objects or arrays inside a cell are stringified crudely; flatten your data first for clean columns.
  • Duplicate header names collapse — the last column with a given name wins when building objects.

Worked example

The CSV name,role / Ada,admin / Bob,editor becomes [{"name":"Ada","role":"admin"},{"name":"Bob","role":"editor"}], and pasting that array back with the toggle flipped reproduces the CSV. To pretty-print or validate the JSON side, use JSON; to convert YAML instead, see YAML ↔ JSON.

Privacy

Everything runs locally; nothing is uploaded.

Frequently asked questions

Are CSV values converted to numbers or booleans?

No. Every CSV field becomes a JSON string, so 42 becomes "42" and true becomes "true". CSV carries no type information, so the converter does not guess. Cast the values yourself afterwards if your target needs real numbers or booleans.

What happens when my JSON objects have different keys?

Going JSON → CSV, the header is the union of every key seen across all objects, in first-seen order. Any object missing a key gets an empty cell in that column, so rows with different shapes still line up under a single consistent header.

How are commas, quotes and newlines inside a field handled?

Per RFC 4180. On input, a field wrapped in double quotes may contain commas and newlines, and a doubled quote ("") means a literal quote. On output, any field containing a comma, quote or newline is wrapped in double quotes with interior quotes doubled.

Related tools