Fuse logo
Home
CSV to JSON Converter

CSV to JSON Converter

CSV to JSON Converter is used to convert CSV data or file into JSON format. You can choose whether the property names are auto-generated or taken from the header row in the CSV. Property names can also be transformed using various naming strategies such as: Camel Case, Lower Case, Upper Case & Snake Case The JSON output can be indented for easier viewing. Source delimiter is automatically detected but can also be manually overridden. The JSON output varies itself according to various strategies. Check out the setting descriptions below.
For paid customers of Tool Slick: Make sure you login to ToolSlick before accessing the tool or else you will be redirected here.
Input
Output
Settings
Configure the settings for the conversion
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
  1. Delimiter
    The delimiter in the input CSV is specified here. In most cases the default setting Auto Detect works fine. But, in really small CSV data with delimiters also occurring as literals, the auto detection logic might not choose the correct delimiter. In such a scenario, the delimiter can be manually specified. Following are the choices for delimiters:-
    • Auto Detect
    • Comma
    • Tab
    • Space
    • Pipe
    • Semi-Colon
  2. Output Type
    This decides how the JSON output is transformed and supports the following modes:-
    • Properties (default)
    • Column Arrays
    • Row Arrays
    • Dictionary Object
    • Dictionary Array

    The examples below assume the following 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
      This is the default output type. At the root of the output is a JSON array inside which there are multiple objects corresponding to a row in the input CSV.
      [
        {
          "Name": "Arsene Wenger",
          "Department": "Bar",
          "Manager": "Friar Tuck",
          "Salary": 50
        },
        {
          "Name": "Friar Tuck",
          "Department": "Foo",
          "Manager": "Robin Hood",
          "Salary": 100
        },
        {
          "Name": "Little John",
          "Department": "Foo",
          "Manager": "Robin Hood",
          "Salary": 100
        },
        {
          "Name": "Dimi Berbatov",
          "Department": "Foo",
          "Manager": "Little John",
          "Salary": 50
        }
      ]
    • Column Arrays
      Here, the CSV data is transformed in a column oriented fashion. At the root of the output is a JSON object which has a property for each column in the input CSV. The value of each of these properties is a JSON array in which each item is taken from one of the data rows in the CSV.
      {
        "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
      Here, the output is an Array of Array with no property names whatsoever. The structure is similar to the Properties output described above. But, there are no column names associated with the output. At the root of the output is a JSON array. Inside the array there are multiple arrays each of which correspond to a row in the input CSV. This inner array in turn is made of the values in each row. The order of the items is the same as in the input CSV.
      [
        [
          "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
      Here, there are no arrays. The output at the root is a JSON object. Thereafter, the first column of each row becomes a property. The value of this property is another object with all the remaining columns in that row. You can think of the output as a Dictionary (in C#) or Map (in Java). The first column of each row must have unique value for this output type to give valid results.
      {
        "Arsene Wenger": {
          "Department": "Bar",
          "Manager": "Friar Tuck",
          "Salary": 50
        },
        "Friar Tuck": {
          "Department": "Foo",
          "Manager": "Robin Hood",
          "Salary": 100
        },
        "Little John": {
          "Department": "Foo",
          "Manager": "Robin Hood",
          "Salary": 100
        },
        "Dimi Berbatov": {
          "Department": "Foo",
          "Manager": "Little John",
          "Salary": 50
        }
      }
    • Dictionary Array
      This is similar to Dictionary Object described above where the output at the root is a JSON object. Thereafter, the first column of each row becomes a property. The value of this property is an array as opposed to another object. The remaining values in each row become elements inside this array object.
      {
        "Arsene Wenger": [
          "Bar",
          "Friar Tuck",
          50
        ],
        "Friar Tuck": [
          "Foo",
          "Robin Hood",
          100
        ],
        "Little John": [
          "Foo",
          "Robin Hood",
          100
        ],
        "Dimi Berbatov": [
          "Foo",
          "Little John",
          50
        ]
      }
  3. Header Transform
    This decides how the property names are transformed in the output JSON. The available strategies are:-
    • 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
        }
      ]
  4. Indent
    This setting governs whether or not the Output is indented. The indented Output is easier to comprehend. On the other hand, a non-indented output is compact. The smaller size is best for transmission over the network. So, we often minify JSON by removing non-essential whitespace.
    • Indentation On
      {
        "name": "John Doe",
        "age": 69
      }
    • Indentation Off
      {"name":"John Doe","age":69}
  5. First Row Is Header
    If this option is selected the first row of your comma separated file is assumed to be the header. The names of the properties are generated using the field values in the first row. If the option is not selected the property names are generated automatically using a numeric pattern: column 1, column 2, column 3, etc. In the latter case the first row is interpreted as raw data.
    • First Row is Header On
      [
        {
          "name": "Robin Hood",
          "department": "Sales",
          "salary": 200
        }
      ]
    • First Row is Header Off
      [
        {
          "column 1": "Name",
          "column 2": "Department",
          "column 3": "Salary"
        },
        {
          "column 1": "Robin Hood",
          "column 2": "Sales",
          "column 3": 200
        }
      ]
Converts Me © 2024 A product by Maxotek.