CSV to JSON Converter

Convert CSV data into JSON. Property names come from the header row or are generated, and can be transformed: camel case, lower case, upper case or snake case. The delimiter is detected for you, and the output can be indented or shaped in several ways - see the settings below.
Input
Output

Settings

How the input is converted. Each is explained below.

Tags

History

CSV is an old & very popular format for storing tabular data. It has been used in the desktop as well as mainframe. It is a simple & compact format that works really well for tabular data and so is still in use today.

JavaScript Object Notation (JSON), pronounced as Jason, is the most common data interchange format on the web. Douglas Crockford first released the JSON specification in the early 2000s. It is a simple format that is easier to comprehend than XML. It is also smaller in size because it does not have closing tags. A wide variety of programming languages can parse JSON files. They also support the serialization of data structures to JSON. You can copy JSON text to JavaScript and start using them without any modifications.

Settings explained

Delimiter
What separates the fields in the input: auto detect, comma, tab, semi-colon, pipe or space. Auto detect works in most cases, but in a very small CSV whose values also contain the delimiter it can guess wrong - choose the delimiter then.
Output type
How the JSON is shaped. The examples below are for this input:
Name,Department,Manager,Salary
Arsene Wenger,Bar,Friar Tuck,50
Friar Tuck,Foo,Robin Hood,100
Little John,Foo,Robin Hood,100
Dimi Berbatov,Foo,Little John,50
Properties (the default): an array with an object for each row
[
  {
    "Name": "Arsene Wenger",
    "Department": "Bar",
    "Manager": "Friar Tuck",
    "Salary": 50
  },
  {
    "Name": "Friar Tuck",
    "Department": "Foo",
    "Manager": "Robin Hood",
    "Salary": 100
  },
  ...
]
Column arrays: an object with an array for each column
{
  "Name": ["Arsene Wenger", "Friar Tuck", "Little John", "Dimi Berbatov"],
  "Department": ["Bar", "Foo", "Foo", "Foo"],
  "Manager": ["Friar Tuck", "Robin Hood", "Robin Hood", "Little John"],
  "Salary": [50, 100, 100, 50]
}
Row arrays: an array of rows, each an array of its values, with no names
[
  ["Arsene Wenger", "Bar", "Friar Tuck", 50],
  ["Friar Tuck", "Foo", "Robin Hood", 100],
  ["Little John", "Foo", "Robin Hood", 100],
  ["Dimi Berbatov", "Foo", "Little John", 50]
]
Dictionary object: each row's first column names an object of the rest - the first column must be unique
{
  "Arsene Wenger": { "Department": "Bar", "Manager": "Friar Tuck", "Salary": 50 },
  "Friar Tuck": { "Department": "Foo", "Manager": "Robin Hood", "Salary": 100 },
  ...
}
Dictionary array: as above, with the rest of the row as an array
{
  "Arsene Wenger": ["Bar", "Friar Tuck", 50],
  "Friar Tuck": ["Foo", "Robin Hood", 100],
  ...
}
Header transform
How the property names are written. For a header of Name, DepartmentName, Salary:
Camel case
[
  {
    "name": "Robin Hood",
    "departmentName": "Sales",
    "salary": 200
  }
]
Lower case
[
  {
    "name": "Robin Hood",
    "departmentname": "Sales",
    "salary": 200
  }
]
Upper case
[
  {
    "NAME": "Robin Hood",
    "DEPARTMENTNAME": "Sales",
    "SALARY": 200
  }
]
Snake case
[
  {
    "name": "Robin Hood",
    "department_name": "Sales",
    "salary": 200
  }
]
None
[
  {
    "Name": "Robin Hood",
    "DepartmentName": "Sales",
    "Salary": 200
  }
]
Indent
Whether the output is indented. Indented JSON is easier to read; without indentation it is compact, which is better for sending over a network.
On
{
  "name": "John Doe",
  "age": 69
}
Off
{"name":"John Doe","age":69}
First row is header
On, the first row names the properties. Off, the properties are named column 1, column 2 and so on, and the first row is read as data.
On
[
  {
    "name": "Robin Hood",
    "department": "Sales",
    "salary": 200
  }
]
Off
[
  {
    "column 1": "Name",
    "column 2": "Department",
    "column 3": "Salary"
  },
  {
    "column 1": "Robin Hood",
    "column 2": "Sales",
    "column 3": 200
  }
]