← All guides

How to Convert CSV to JSON (and Why)

CSV is a flat table; JSON is nested and typed. Learn how a CSV maps to JSON, the common pitfalls with commas and quotes, and how to convert instantly.

Converting CSV to JSON turns each row of a spreadsheet into an object, using the header row as the keys. A CSV like name,age / Ada,36 becomes [{"name":"Ada","age":"36"}].

How the mapping works

  • The first row is the header — each column name becomes a JSON key
  • Each following row becomes one object in an array
  • Values are usually kept as strings unless you convert numbers and booleans

Common pitfalls

  • Commas inside values must be wrapped in quotes: "Smith, Ada"
  • Quotes inside values are escaped by doubling them: ""
  • Blank cells become empty strings or null, depending on the tool

Why convert?

CSV is compact and works in spreadsheets, but JSON is what APIs and JavaScript expect, supports nested structure and types, and is easier to process in code.

Convert now

Paste a CSV into the CSV to JSON converter to get clean JSON instantly, in your browser. Then tidy it with the JSON formatter. Related: What is JSON and how to format it.