> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.itential.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server.

# csvStringToJSON

> Use the csvStringToJSON task to convert a CSV string to JSON format.

The `csvStringToJson` task converts a CSV string to JSON format.

Given an input table like this:

| first\_name | last\_name | postalcode | enrolled |
| :---------- | :--------- | :--------- | :------- |
| Jane        | Smith      | 12345      | true     |
| John        | Walker     |            | false    |

The CSV should be structured like this (using semicolons as the field delimiter):

```
first_name;last_name;postalcode;enrolled
Jane;Smith;12345;true
John;Walker;;false
```

When a semicolon is matched, a new JSON entry is created. The resulting JSON is:

```json
[
  {
    "first_name": "Jane",
    "last_name": "Smith",
    "postalcode": "12345",
    "enrolled": "true"
  },
  {
    "first_name": "John",
    "last_name": "Walker",
    "postalcode": "",
    "enrolled": "false"
  }
]
```

## Properties

| Incoming          | Type    | Description                                          |
| :---------------- | :------ | :--------------------------------------------------- |
| `input`           | String  | Input CSV content to convert to JSON.                |
| `headersIncluded` | Boolean | Indicates whether headers are included in the input. |
| `headerRow`       | Array   | Optional array of headers to use for mapping.        |

| Outgoing   | Type   | Description                               |
| :--------- | :----- | :---------------------------------------- |
| `response` | String | The CSV content converted to JSON format. |

## How to configure

Upload a CSV file with the input variables for the workflow. Set the `input` reference variable to the contents of the CSV file with a static variable source. Set `headersIncluded` to `true`.

You can convert a CSV file to Base64 format using a converter tool of your choice.

The `response` returned by this task contains the comma-separated values converted to JSON format. You can view the outgoing properties in **Operations Manager** when the task is complete.

## Potential use case

If you are building a workflow and need to convert inputs to JSON format, upload a CSV file with the input variables instead of filling in a JSON form. After the `csvStringToJson` task converts the values to JSON, the variables can be queried from the output and used in further tasks.

## Related reading

* [csvStringToJSON API](https://apidocs.itential.com/2023.2/api/app-workflow_engine/csvStringToJson/)
* [excelToJson API](https://apidocs.itential.com/2023.2/api/app-workflow_engine/excelToJson/)