CSV to JSON

Convert CSV (with header row) to a JSON array.

Open tool

Overview

The CSV-to-JSON converter turns a CSV with a header row into a JSON array of objects, one per data row. Cell values can be left as strings or coerced to numbers, booleans, and nulls based on their content.

It's the everyday glue between spreadsheet exports and APIs, JSON-based config, or NoSQL imports. Developers, data engineers, and anyone building a quick fixture file reach for a csv to json converter to skip writing parsing code for a one-off translation.

How it works

The CSV is parsed per RFC 4180 — quoted fields, embedded commas, doubled quotes, and CRLF line endings are all handled. The first row supplies object keys. Each subsequent row becomes an object whose values are pulled from the same column positions.

Optional type inference tries int.TryParse, double.TryParse, and known boolean tokens (true/false, yes/no, 1/0) under invariant culture. Empty cells become either the JSON literal null or the empty string depending on the chosen option. Output indentation is configurable so you can produce compact or pretty JSON.

Examples

Input CSV:
name,age,active
Alice,30,true
Bob,42,false

Output JSON:
[
  { "name": "Alice", "age": 30, "active": true },
  { "name": "Bob",   "age": 42, "active": false }
]
Input CSV (quoted commas):
title,price
"Foo, Bar",9.99
Baz,1

Output JSON:
[
  { "title": "Foo, Bar", "price": 9.99 },
  { "title": "Baz",      "price": 1 }
]

FAQ

What if my CSV has no header row?

Add one before pasting, or use the CSV header normaliser first to generate synthetic column names. JSON objects need keys, so a header row is required for this conversion.

Can I get NDJSON (one object per line) instead of an array?

Yes — the NDJSON formatter tool emits exactly that shape. This converter produces a standard JSON array suitable for JSON.parse.

How are dates handled?

Dates stay as strings unless your downstream parser knows how to interpret them. JSON has no native date type, so coercing would lose information.

Try CSV to JSON

An unhandled error has occurred. Reload ×