# How to convert a message to CSV data format

In this tutorial we will be converting a valid key\value pair of data in the message to CSV format.

  1. TDB Following is the input payload object which we will be using in this use case.

         uid: 10,
         name: tony,
         address: 9, Strathfield, nsw
  2. Drag and drop set property node from the transformation section in the pallette. Double click the node to open the editor.

  3. Click Add button under rules and select Set . Configure the Set field value as msg.payload. Select JSONata for the to field type and provide the following on value section of to field.

    "uid": $floor(100*$random()),
    "name": 'tony',
    "address": '9, Strathfield, NSW'
    "uid": $floor(100*$random()),
    "name": 'Harry',
    "address": '10, Redfern, NSW'
    "uid": $floor(100*$random()),
    "name": 'Dan',
    "address": '233, Parramatta, NSW'
  1. Wire the TBD to set property node.

  2. Drop CSV node from the transformation section to the canvas . Double click the csv node to open the editor.

  3. On columns field set the csv column names as uid, name, address .


These field also become the header if the include column name row checkbox on Output is checked.

  1. Keep the rest of the values as default and click Save.

  2. Wire the set property node to CSV node.

  3. Drop the debug node to the end of the flow and name it as Completed.

  4. Wire the CSV node to debug node.

  5. Now click the TBD to test the flow.


On the debug panel on the final debug node (Completed) the following payload will be printed.

77,tony,"9, Strathfield, NSW"
50,Harry,"10, Redfern, NSW"
47,Dan,"233, Parramatta, NSW"