In this guide, we will be creating a short process that reads CSV data and converts it into JSON data. This guide will use a sample dataset as an example of CSV data. The example CSV dataset can be found below

1,Addie Henderson,19
2,Lilly Reeves,21
3,Rebecca Bradley,47
4,Joseph Bryan,46
5,Juan Gibson,58
6,Melvin Armstrong,52
7,Elsie Curtis,63
8,Mable Salazar,18
9,Mittie Parsons,18
10,Andrew Cooper,31

Steps for Creating the Process

  • Create a process and give it a name. Create a new Task and attach it to the process trigger.

  • Within the new Task, assign "Parse" from the "Select a task" dropdown menu found in the "FRENDS.CSV" section as seen below.

  • Next, insert the example CSV dataset into the "Csv" field within the Task. In the delimiter field, enter the delimiter that is used in the CSV data you are transforming. In the case of the example dataset, the delimiter is a comma.

  • Next, click the "Add item" button in the "Column specifications" field. For each column of data, you must add an item to specify the contents of the column. In the case of the example dataset, you need 3 items as there are 3 columns. Within the "Name" field, you can enter the name that you believe suits the data of the specific column. The dropdown menu named "Type" can be left to String. The following pictures show how the "Column specifications" field should look for the example dataset.

    If you want, you can leave the whole "Column specifications" empty, but in that case, it is up to frends to guess column names and data types, and because our data won't include headers all column names would not have names in that case.

  • Now, change the tab from "Input" to "Option" found towards the top of the Task. If your CSV dataset includes headers, then ensure that the "Contains header row" field is on. If the dataset does not include headers, such as the example dataset, ensure that the field is off.

  • Finally, attach a Return to the Parse Task. Within the "Expression" field in the Return, enter

    #result["Name of Parse Task"].ToJson()

  • The final process should look similar to this

  • When looking at the Result and selecting "Show raw", the first few lines of the returned JSON data transformed from the sample CSV data should look similar to this

    [ 
    {
    "Index": "1",
    "Name": "Addie Henderson",
    "Age": "19"
    },
    {
    "Index": "2",
    "Name": "Lilly Reeves",
    "Age": "21"
    },
    {
    "Index": "3",
    "Name": "Rebecca Bradley",
    ...

Did this answer your question?