How to Convert CSV to JSON

· 3 min read

CSV (Comma-Separated Values) is the simplest format for tabular data — every spreadsheet can export it. JSON (JavaScript Object Notation) is the standard format for web APIs and modern applications. Converting between them is one of the most common data tasks in development.

When you need CSV to JSON

How CSV becomes JSON

A CSV file:

name,age,city
Alice,30,New York
Bob,25,London

Becomes a JSON array of objects:

[
  {"name": "Alice", "age": "30", "city": "New York"},
  {"name": "Bob", "age": "25", "city": "London"}
]

The first row (headers) becomes the keys. Each subsequent row becomes an object.

How to convert

  1. Paste your CSV data — enter comma-separated data with a header row.
  2. Choose your delimiter — select comma, semicolon, tab, or pipe. The tool auto-detects in most cases.
  3. Copy or download — review the JSON output and copy it to your clipboard or download as a .json file.

Handling tricky CSV data

Quoted values — when a value contains the delimiter character (like an address with a comma), it should be wrapped in double quotes: "New York, NY". Good converters handle this correctly.

Empty values — empty cells become empty strings in JSON ("field": ""). If you need them as null, you may need to post-process the output.

Numeric values — CSV does not have data types. Everything is text. The JSON output will have numbers as strings ("30" not 30). If your application needs actual numbers, parse them after conversion.

Line breaks in values — some CSV files have multi-line values (enclosed in quotes). Not all converters handle this — test with your specific data.

Tips

Frequently Asked Questions

What happens to the header row?

The first row is used as keys for the JSON objects. Each subsequent row becomes an object with those keys. For example, a header of "name,age" with a row of "Alice,30" becomes {"name":"Alice","age":"30"}.

What delimiters are supported?

Comma, semicolon, tab, and pipe delimiters are all supported. The tool can auto-detect which delimiter your data uses, or you can select it manually.

Does it handle commas inside values?

Yes. Values enclosed in double quotes (like "New York, NY") are handled correctly — the comma inside the quotes is treated as part of the value, not a separator.

Is my data sent to a server?

No. All conversion happens in your browser. Your data never leaves your device.