Skip to main content

Change Data Format Component

Change data from one format to another

Component key: change-data-format

Description#

The change data format component allows you to convert data between common formats, like JSON, XML, CSV, and YAML, and to serialize (turn an object into a string) or deserialize (turn a string into an object) each supported format.

For example, the "JSON to XML" action will convert a JSON string that looks like this:

{  "user": {    "name": "John Doe",    "dob": "19880101",    "phones": ["555-123-4567", "555-555-5555"]  }}

into an XML string that looks like this:

<user>  <name>John Doe</name>  <dob>19880101</dob>  <phones>555-123-4567</phones>  <phones>555-555-5555</phones></user>

A "Deserialize XML" action, when run on the above XML, would convert the XML into an object whose keys can be referenced in subsequent steps.

Actions#

Convert To Boolean#

Convert a value to a number | key: convertToBoolean

InputNotes
Input
The value to be converted to a boolean
string
/ Required
value
Notes
 

Convert To Integer#

Convert a value to an int | key: convertToInt

InputNotes
Input
The value to be converted to a integer
string
/ Required
value
Notes
 

Convert To Number#

Convert a value to a number | key: convertToNumber

InputNotes
Input
The value to be converted to a number
string
/ Required
value
Notes
 

Convert To String#

Convert a value to a string | key: convertToString

InputNotes
Input
The value to be converted to a string
string
/ Required
value
Notes
 

CSV to JSON#

Convert CSV to JSON | key: csvToJson

InputDefaultNotesExample
Input
Data
code
/ Required
data
Default
Notes
CSV data to convert to JSON
Example
"person__first","person__last","dob""Bob","Johnson","1990-01-01"
Input
CSV Header
boolean
isHeader
Default
true
Notes
Specify if your CSV contains a header row.
Example
 

Output Example Payload#

{  "data": "{\n  \"person\": {\n    \"first\": \"Bob\",\n    \"last\": \"Johnson\"\n  },\n  \"dob\": \"1990-01-01\"\n}",  "contentType": "application/json"}

CSV to XML#

Convert CSV to XML | key: csvToXml

InputDefaultNotesExample
Input
Data
code
/ Required
data
Default
Notes
CSV data to convert to XML
Example
"person__first","person__last","dob""Bob","Johnson","1990-01-01"
Input
CSV Header
boolean
isHeader
Default
true
Notes
Specify if your CSV contains a header row.
Example
 

Output Example Payload#

{  "data": "<dob>1990-01-01</dob>\n<person>\n  <first>Bob</first>\n  <last>Johnson</last>\n</person>",  "contentType": "text/xml"}

CSV to YAML#

Convert CSV to YAML | key: csvToYaml

InputDefaultNotesExample
Input
Data
code
/ Required
data
Default
Notes
CSV data to convert to YAML
Example
"person__first","person__last","dob""Bob","Johnson","1990-01-01"
Input
CSV Header
boolean
isHeader
Default
true
Notes
Specify if your CSV contains a header row.
Example
 

Output Example Payload#

{  "data": "---\nperson:\n  first: Bob\n  last: Johnson\ndob: '1990-01-01'",  "contentType": "text/yaml"}

Deserialize BINARY#

Deserialize BINARY data | key: deserializeFromBinary

InputNotes
Input
Data
code
/ Required
data
Notes
BINARY text to deserialize so it can be referenced in a subsequent step.

Output Example Payload#

{  "data": {    "person": {      "first": "Bob",      "last": "Johnson"    },    "dob": "1990-01-01"  }}

Deserialize CSV#

Deserialize CSV data | key: deserializeFromCsv

InputDefaultNotesExample
Input
Data
code
/ Required
data
Default
Notes
CSV text to deserialize so it can be referenced in a subsequent step.
Example
"person__first","person__last","dob""Bob","Johnson","1990-01-01"
Input
CSV Header
boolean
isHeader
Default
true
Notes
Specify if your CSV contains a header row.
Example
 

Output Example Payload#

{  "data": {    "person": {      "first": "Bob",      "last": "Johnson"    },    "dob": "1990-01-01"  }}

Deserialize JSON#

Deserialize JSON data | key: deserializeFromJson

InputNotesExample
Input
Data
code
/ Required
data
Notes
JSON text to deserialize so it can be referenced in a subsequent step.
Example
{  "person": {    "first": "Bob",    "last": "Johnson"  },  "dob": "1990-01-01"}

Output Example Payload#

{  "data": {    "person": {      "first": "Bob",      "last": "Johnson"    },    "dob": "1990-01-01"  }}

Deserialize JSON Lines (.jsonl)#

Transform .jsonl data to a JavaScript array | key: deserializeJsonl

InputNotesExample
Input
JSONL Data
code
/ Required
jsonl
Notes
 
Example
["Name", "Session", "Score", "Completed"]["Gilbert", "2013", 24, true]["Alexa", "2013", 29, true]["May", "2012B", 14, false]["Deloise", "2012A", 19, true]

Deserialize URL-encoded Form Data#

Deserialize Form Data (x-www-form-urlencoded) | key: deserializeFormData

InputNotesExample
Input
Data
string
/ Required
data
Notes
Form data to deserialize so it can be referenced in a subsequent step.
Example
foo=bar&baz=123

Output Example Payload#

{  "data": {    "foo": "bar",    "baz": "123"  }}

Deserialize XML#

Deserialize XML data | key: deserializeFromXml

InputDefaultNotesExample
Input
Data
code
/ Required
data
Default
Notes
XML text to deserialize so it can be referenced in a subsequent step.
Example
<dob>1990-01-01</dob><person>  <first>Bob</first>  <last>Johnson</last></person>
Input
Parse numbers as strings?
boolean
numbersAsStrings
Default
false
Notes
Interpret numbers as strings?
Example
 

Output Example Payload#

{  "data": {    "person": {      "first": "Bob",      "last": "Johnson"    },    "dob": "1990-01-01"  }}

Deserialize YAML#

Deserialize YAML data | key: deserializeFromYaml

InputNotesExample
Input
Data
code
/ Required
data
Notes
YAML text to deserialize so it can be referenced in a subsequent step.
Example
---person:  first: Bob  last: Johnsondob: '1990-01-01'

Output Example Payload#

{  "data": {    "person": {      "first": "Bob",      "last": "Johnson"    },    "dob": "1990-01-01"  }}

JavaScript Object to CSV#

Convert JavaScript Object to CSV | key: binaryToCsv

InputNotes
Input
Data
code
/ Required
data
Notes
JavaScript Object data to convert to CSV

Output Example Payload#

{  "data": "\"person__first\",\"person__last\",\"dob\"\n\"Bob\",\"Johnson\",\"1990-01-01\"",  "contentType": "text/csv"}

JavaScript Object to JSON#

Convert JavaScript Object to JSON | key: binaryToJson

InputNotes
Input
Data
code
/ Required
data
Notes
JavaScript Object data to convert to JSON

Output Example Payload#

{  "data": "{\n  \"person\": {\n    \"first\": \"Bob\",\n    \"last\": \"Johnson\"\n  },\n  \"dob\": \"1990-01-01\"\n}",  "contentType": "application/json"}

JavaScript Object to XML#

Convert JavaScript Object to XML | key: binaryToXml

InputNotes
Input
Data
code
/ Required
data
Notes
JavaScript Object data to convert to XML

Output Example Payload#

{  "data": "<dob>1990-01-01</dob>\n<person>\n  <first>Bob</first>\n  <last>Johnson</last>\n</person>",  "contentType": "text/xml"}

JavaScript Object to YAML#

Convert JavaScript Object to YAML | key: binaryToYaml

InputNotes
Input
Data
code
/ Required
data
Notes
JavaScript Object data to convert to YAML

Output Example Payload#

{  "data": "---\nperson:\n  first: Bob\n  last: Johnson\ndob: '1990-01-01'",  "contentType": "text/yaml"}

JSON to CSV#

Convert JSON to CSV | key: jsonToCsv

InputNotesExample
Input
Data
code
/ Required
data
Notes
JSON data to convert to CSV
Example
{  "person": {    "first": "Bob",    "last": "Johnson"  },  "dob": "1990-01-01"}

Output Example Payload#

{  "data": "\"person__first\",\"person__last\",\"dob\"\n\"Bob\",\"Johnson\",\"1990-01-01\"",  "contentType": "text/csv"}

JSON to XML#

Convert JSON to XML | key: jsonToXml

InputNotesExample
Input
Data
code
/ Required
data
Notes
JSON data to convert to XML
Example
{  "person": {    "first": "Bob",    "last": "Johnson"  },  "dob": "1990-01-01"}

Output Example Payload#

{  "data": "<dob>1990-01-01</dob>\n<person>\n  <first>Bob</first>\n  <last>Johnson</last>\n</person>",  "contentType": "text/xml"}

JSON to YAML#

Convert JSON to YAML | key: jsonToYaml

InputNotesExample
Input
Data
code
/ Required
data
Notes
JSON data to convert to YAML
Example
{  "person": {    "first": "Bob",    "last": "Johnson"  },  "dob": "1990-01-01"}

Output Example Payload#

{  "data": "---\nperson:\n  first: Bob\n  last: Johnson\ndob: '1990-01-01'",  "contentType": "text/yaml"}

Pretty Print#

Format data to be more human-readable | key: prettyPrint

InputNotes
Input
Data
text
/ Required
data
Notes
Data to pretty print

Serialize JSON Lines (.jsonl)#

Serialize an array of JavaScript objects into .jsonl | key: serializeJsonl

InputNotes
Input
Array of JavaScript Objects to serialize
string
/ Required
array
Notes
Must be a reference to an array of JavaScript objects

Serialize URL-encoded Form Data#

Serialize Form Data (x-www-form-urlencoded) | key: serializeFormData

InputNotes
Input
Data
code
/ Required
data
Notes
Form data to deserialize so it can be referenced in a subsequent step.

Output Example Payload#

{  "data": "foo=bar&baz=123"}

XML to CSV#

Convert XML to CSV | key: xmlToCsv

InputDefaultNotesExample
Input
Data
code
/ Required
data
Default
Notes
XML data to convert to CSV
Example
<dob>1990-01-01</dob><person>  <first>Bob</first>  <last>Johnson</last></person>
Input
Parse numbers as strings?
boolean
numbersAsStrings
Default
false
Notes
Interpret numbers as strings?
Example
 

Output Example Payload#

{  "data": "\"person__first\",\"person__last\",\"dob\"\n\"Bob\",\"Johnson\",\"1990-01-01\"",  "contentType": "text/csv"}

XML to JSON#

Convert XML to JSON | key: xmlToJson

InputDefaultNotesExample
Input
Data
code
/ Required
data
Default
Notes
XML data to convert to JSON
Example
<dob>1990-01-01</dob><person>  <first>Bob</first>  <last>Johnson</last></person>
Input
Parse numbers as strings?
boolean
numbersAsStrings
Default
false
Notes
Interpret numbers as strings?
Example
 

Output Example Payload#

{  "data": "{\n  \"person\": {\n    \"first\": \"Bob\",\n    \"last\": \"Johnson\"\n  },\n  \"dob\": \"1990-01-01\"\n}",  "contentType": "application/json"}

XML to YAML#

Convert XML to YAML | key: xmlToYaml

InputDefaultNotesExample
Input
Data
code
/ Required
data
Default
Notes
XML data to convert to YAML
Example
<dob>1990-01-01</dob><person>  <first>Bob</first>  <last>Johnson</last></person>
Input
Parse numbers as strings?
boolean
numbersAsStrings
Default
false
Notes
Interpret numbers as strings?
Example
 

Output Example Payload#

{  "data": "---\nperson:\n  first: Bob\n  last: Johnson\ndob: '1990-01-01'",  "contentType": "text/yaml"}

YAML to CSV#

Convert YAML to CSV | key: yamlToCsv

InputNotesExample
Input
Data
code
/ Required
data
Notes
YAML data to convert to CSV
Example
---person:  first: Bob  last: Johnsondob: '1990-01-01'

Output Example Payload#

{  "data": "\"person__first\",\"person__last\",\"dob\"\n\"Bob\",\"Johnson\",\"1990-01-01\"",  "contentType": "text/csv"}

YAML to JSON#

Convert YAML to JSON | key: yamlToJson

InputNotesExample
Input
Data
code
/ Required
data
Notes
YAML data to convert to JSON
Example
---person:  first: Bob  last: Johnsondob: '1990-01-01'

Output Example Payload#

{  "data": "{\n  \"person\": {\n    \"first\": \"Bob\",\n    \"last\": \"Johnson\"\n  },\n  \"dob\": \"1990-01-01\"\n}",  "contentType": "application/json"}

YAML to XML#

Convert YAML to XML | key: yamlToXml

InputNotesExample
Input
Data
code
/ Required
data
Notes
YAML data to convert to XML
Example
---person:  first: Bob  last: Johnsondob: '1990-01-01'

Output Example Payload#

{  "data": "<dob>1990-01-01</dob>\n<person>\n  <first>Bob</first>\n  <last>Johnson</last>\n</person>",  "contentType": "text/xml"}