Skip to content

CSV ↔ JSON Converter

Convert CSV to JSON and vice versa. Preview data as a table before exporting.

How it works

In CSV→JSON mode, the first row becomes the header and every following line is mapped to an object keyed by those headers. The result is a pretty-printed JSON array you can copy straight into code, fixtures or a seed script. In JSON→CSV mode, an array of flat objects is flattened back into rows with a generated header line — the reverse trip for exports and spreadsheets.

The Table Preview tab renders the current data as a grid, which is the fastest sanity check before converting: misaligned columns, shifted values and header mistakes are obvious in a table but easy to miss in raw text. The Copy button takes the converted output exactly as shown.

The parser is deliberately simple and predictable: it splits on newlines and commas and trims whitespace. That covers the vast majority of hand-written and exported CSV, but it does not implement RFC 4180 quoting — values that themselves contain commas, quotes or line breaks need a fully quoted CSV source. The Common errors section below shows how to spot and fix those cases.

Both directions run locally in your browser, which matters because CSV exports frequently contain personal data — emails, names, internal IDs — that should not be pasted into a server-side converter.

Worked example

Convert a three-row contact CSV. The header line defines the keys; each data line becomes one object in the output array.

CSV rowBecomes
name,email,ageHeader row → object keys.
Alice,alice@example.com,28{"name":"Alice","email":"alice@example.com","age":"28"}
Bob,bob@example.com,34{"name":"Bob","email":"bob@example.com","age":"34"}
  1. Choose the direction: CSV → JSON for imports and fixtures, JSON → CSV for exports and spreadsheets.
  2. Paste the data: CSV needs a header line; JSON needs an array of flat objects.
  3. Check the table: Use Table Preview to catch shifted columns before converting.
  4. Convert and copy: Copy the output and cast types in your application code.

Note that age arrives as the string "28", not the number 28 — CSV is untyped, so every field is text. Convert types explicitly in your application after parsing.

Common errors and edge cases

  • Commas inside values. Doe, John splits into two columns. Wrap such values in quotes in the source, or clean them before converting.
  • Ragged rows. A row with fewer fields than the header produces keys with empty values; extra fields are dropped. Check the Table Preview for shifted columns.
  • All values are strings. Numbers, booleans and nulls do not survive CSV. Parse and cast types in your code after conversion.
  • Nested JSON. JSON→CSV expects a flat array of objects. Nested objects and arrays are stringified into single cells; flatten first if you need clean columns.
  • Encoding issues. Excel CSVs may arrive as Latin-1 or with a BOM. Mojibake such as é means the file was decoded with the wrong charset upstream.

Code equivalents

For quoted, production-grade CSV use a real parser; for the simple cases this tool covers, the conversion is a few lines.

LanguageExample
Python 3list(csv.DictReader(open('data.csv'))) gives the same array-of-objects; csv.DictWriter writes the reverse.
Node.jsconst rows = csv.trim().split('\n').map(l => l.split(',')) for simple data; use csv-parse for quoted CSV.
Type castingNumber(row.age), row.active === 'true' — CSV fields are always strings.

Frequently asked questions

Does the converter handle quoted CSV with commas inside values?

No — it uses a simple split on commas and newlines. For RFC 4180 quoted CSV, export a clean version or use a full parser such as Python's csv module.

Why are my numbers strings in the JSON output?

CSV carries no type information; every field is text. Cast values explicitly in your application after conversion.

What JSON shape does JSON→CSV expect?

An array of flat objects with consistent keys. Keys become the header row; nested values are stringified into single cells.

How do I detect a broken row before converting?

Open the Table Preview: ragged rows show up as shifted or empty columns, which is much easier to spot than in raw text.

Is my data uploaded for conversion?

No. Both directions run entirely in your browser, so exports containing personal or internal data stay on your machine.

Privacy note

All processing happens in your browser. The values you enter never leave your device and are never transmitted to ToolPlex.