CSV to JSON

What is a Csv To Json?

CSV is the universal export format of spreadsheets and databases, while JSON is what APIs, JavaScript and NoSQL databases expect. This converter parses CSV, including quoted fields and embedded commas, and produces a JSON array of objects using the header row as keys.

How to use it

  1. Paste CSV data.
  2. Confirm that the first row contains headers.
  3. Copy the pretty-printed JSON output.

Example

Input:

id,name,city
1,Asha,Pune
2,Ben,'Leeds, UK'

(In real CSV, the field with a comma is wrapped in double quotes.) Output:

[
  { 'id': '1', 'name': 'Asha', 'city': 'Pune' },
  { 'id': '2', 'name': 'Ben', 'city': 'Leeds, UK' }
]

(Real JSON output uses double quotes.) Note that the quoted comma stays inside the city value.

CSV rules that trip people up

  • Quoted fields: values containing commas, line breaks or quotes must be wrapped in double quotes, and a quote inside a value is written twice.
  • Delimiters: European exports often use semicolons because the comma is the decimal separator.
  • Types: CSV has no types, so numbers and booleans may arrive as strings. Convert them in code if your API expects numbers.
  • Encoding: files saved from Excel may include a byte order mark at the start of the first header, which can show up as a strange character in the first key.
  • Empty values become empty strings, not null.

All parsing happens in your browser.

Frequently Asked Questions

How are CSV headers used?

The first row becomes the keys of each JSON object, and each following row becomes one object.

Why are my numbers strings in the JSON?

CSV does not store data types, so values are read as text. Convert them in your code if needed.

Can it handle commas inside values?

Yes, when those values are wrapped in double quotes, as the CSV standard requires.

What if my file uses semicolons?

Semicolon-separated files are common in Europe. Make sure the correct delimiter is detected or selected.