Decode CSV

Decodes CSV format to JSON format

The Decode CSV action decodes data in CSV format. When applied to your processing rule, the Decode CSV action converts your CSV data to JSON format in your pipeline. The Decode CSV action converts the record from a source record to a destination record in your pipeline.

For example, given the following sample website CSV log data:

timestamp,user_id,page_id,action
2023-03-28T09:08:41.64283645Z,3,30,purchase
2023-03-28T09:08:42.643343109Z,4,10,purchase
2023-03-28T09:08:48.643600498Z,1,50,click
2023-03-28T09:08:50.643773688Z,5,40,purchase
2023-03-28T09:08:51.643932272Z,1,30,purchase
2023-03-28T09:08:56.644080944Z,2,40,click
2023-03-28T09:09:03.64425954Z,3,30,click
2023-03-28T09:09:03.644317046Z,1,20,view
2023-03-28T09:09:10.64447719Z,2,50,purchase
2023-03-28T09:09:17.644810963Z,2,10,view
2023-03-28T09:09:20.644994805Z,1,50,view

To decode the data from CSV format to JSON:

  1. In the processing rules tab, in the Actions dropdown, select Decode CSV.

  2. In the Source key field, enter log.

  3. In the Destination key field, enter decoded_csv.

  4. Optional: Select Parse header if you want the first row of parsed CSV to be treated as the header, with subsequent rows being parsed as key/value pairs. If not selected, the data will be parsed as array of values.

  5. Click Apply.

Your processing rule will now convert every record in your pipeline from CSV format to JSON format. It will also add the log key to each CSV record, and a decoded_csv key to each converted record.

Selecting the Parse header checkbox gives the following result:

Last updated