CSV to JSON and JSON to CSV

Converts data between CSV and JSON in either direction. It is useful when a spreadsheet export needs to become data for a web page or app, or when JSON needs to open neatly in a spreadsheet. Uneven rows and other problems are listed so you can fix them.

Up to 1 MiB.

Options

Off keeps every value as text, exactly as written.

Cells starting with =, +, -, @ or a tab get a leading apostrophe so spreadsheet programs do not run them.

How to use the CSV to JSON and JSON to CSV

  1. Choose CSV to JSON or JSON to CSV and paste your data.
  2. Select Convert. Problems such as uneven rows are listed as notes.

CSV to JSON

  • Follows RFC 4180: quoted fields can contain delimiters, line breaks and doubled quotes ("").
  • With column names, each row becomes an object; duplicate names get _2, _3. Values stay text unless you choose to convert numbers, true/false and empty cells.

JSON to CSV

  • Takes an array of objects (columns from all keys, in order of first appearance) or an array of arrays. Nested values are written as JSON text.
  • Protect against spreadsheet formulas (on by default) adds an apostrophe before cells starting with =, +, - or @, so spreadsheet programs do not run them. Turn it off when the CSV is not opened in a spreadsheet.

Limitations

  • Numbers keep their exact text; only values that convert without any change are turned into numbers.

Worked examples

CSV with quoted fields

Input

name,city,age
"Tan, Mei",Penang,34
Ali,"Kuala Lumpur",28

Result

[
  {
    "name": "Tan, Mei",
    "city": "Penang",
    "age": 34
  },
  {
    "name": "Ali",
    "city": "Kuala Lumpur",
    "age": 28
  }
]
JSON to CSV with formula protection

Input

[{"item":"Tea","price":4.5},{"item":"=SUM(A1:A9)","price":0}]

Result

item,price
Tea,4.5
'=SUM(A1:A9),0

Practical uses

  • Prepare data for a web page

    A front-end developer has rows exported from a spreadsheet and needs JSON for a prototype. They choose CSV to JSON, paste the data and select Convert. With column names switched on, each row becomes an object in an array.

  • Export JSON to a spreadsheet

    An analyst receives JSON from a colleague and wants to open it in a spreadsheet. They choose JSON to CSV and paste the array of objects. The conversion gives rows and columns that import cleanly, and cells that start with a formula character are protected by default.

Privacy: this tool runs entirely in your browser. Your text is not uploaded, logged or saved, and it is never sent to analytics. Maximum input: 1 MiB.