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#

CSV to JSON#

Convert CSV to JSON | key: csvToJson

InputKeyNotesExample

Data

text
/ Required
dataCSV data to convert to JSON
"person__first","person__last","dob""Bob","Johnson","1990-01-01"

Output Example Payload#

{  "data": "example",  "contentType": "text/plain"}

CSV to XML#

Convert CSV to XML | key: csvToXml

InputKeyNotesExample

Data

text
/ Required
dataCSV data to convert to XML
"person__first","person__last","dob""Bob","Johnson","1990-01-01"

Output Example Payload#

{  "data": "example",  "contentType": "text/plain"}

CSV to YAML#

Convert CSV to YAML | key: csvToYaml

InputKeyNotesExample

Data

text
/ Required
dataCSV data to convert to YAML
"person__first","person__last","dob""Bob","Johnson","1990-01-01"

Output Example Payload#

{  "data": "example",  "contentType": "text/plain"}

Deserialize BINARY#

Deserialize BINARY data | key: deserializeFromBinary

InputKeyNotes

Data

text
/ Required
dataBINARY text to deserialize to it can be referenced in a subsequent step.

Output Example Payload#

{  "data": {    "key": "example"  }}

Deserialize CSV#

Deserialize CSV data | key: deserializeFromCsv

InputKeyNotesExample

Data

text
/ Required
dataCSV text to deserialize to it can be referenced in a subsequent step.
"person__first","person__last","dob""Bob","Johnson","1990-01-01"

Output Example Payload#

{  "data": {    "key": "example"  }}

Deserialize JSON#

Deserialize JSON data | key: deserializeFromJson

InputKeyNotesExample

Data

text
/ Required
dataJSON text to deserialize to it can be referenced in a subsequent step.
{  "person": {    "first": "Bob",    "last": "Johnson"  },  "dob": "1990-01-01"}

Output Example Payload#

{  "data": {    "key": "example"  }}

Deserialize XML#

Deserialize XML data | key: deserializeFromXml

InputKeyNotesExample

Data

text
/ Required
dataXML text to deserialize to it can be referenced in a subsequent step.
<dob>1990-01-01</dob><person>  <first>Bob</first>  <last>Johnson</last></person>

Output Example Payload#

{  "data": {    "key": "example"  }}

Deserialize YAML#

Deserialize YAML data | key: deserializeFromYaml

InputKeyNotesExample

Data

text
/ Required
dataYAML text to deserialize to it can be referenced in a subsequent step.
---person:  first: Bob  last: Johnsondob: '1990-01-01'

Output Example Payload#

{  "data": {    "key": "example"  }}

JavaScript Object to CSV#

Convert JavaScript Object to CSV | key: binaryToCsv

InputKeyNotes

Data

text
/ Required
dataJavaScript Object data to convert to CSV

Output Example Payload#

{  "data": "example",  "contentType": "text/plain"}

JavaScript Object to JSON#

Convert JavaScript Object to JSON | key: binaryToJson

InputKeyNotes

Data

text
/ Required
dataJavaScript Object data to convert to JSON

Output Example Payload#

{  "data": "example",  "contentType": "text/plain"}

JavaScript Object to XML#

Convert JavaScript Object to XML | key: binaryToXml

InputKeyNotes

Data

text
/ Required
dataJavaScript Object data to convert to XML

Output Example Payload#

{  "data": "example",  "contentType": "text/plain"}

JavaScript Object to YAML#

Convert JavaScript Object to YAML | key: binaryToYaml

InputKeyNotes

Data

text
/ Required
dataJavaScript Object data to convert to YAML

Output Example Payload#

{  "data": "example",  "contentType": "text/plain"}

JSON to CSV#

Convert JSON to CSV | key: jsonToCsv

InputKeyNotesExample

Data

text
/ Required
dataJSON data to convert to CSV
{  "person": {    "first": "Bob",    "last": "Johnson"  },  "dob": "1990-01-01"}

Output Example Payload#

{  "data": "example",  "contentType": "text/plain"}

JSON to XML#

Convert JSON to XML | key: jsonToXml

InputKeyNotesExample

Data

text
/ Required
dataJSON data to convert to XML
{  "person": {    "first": "Bob",    "last": "Johnson"  },  "dob": "1990-01-01"}

Output Example Payload#

{  "data": "example",  "contentType": "text/plain"}

JSON to YAML#

Convert JSON to YAML | key: jsonToYaml

InputKeyNotesExample

Data

text
/ Required
dataJSON data to convert to YAML
{  "person": {    "first": "Bob",    "last": "Johnson"  },  "dob": "1990-01-01"}

Output Example Payload#

{  "data": "example",  "contentType": "text/plain"}

Pretty Print#

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

InputKeyNotes

Data

text
/ Required
dataData to pretty print

XML to CSV#

Convert XML to CSV | key: xmlToCsv

InputKeyNotesExample

Data

text
/ Required
dataXML data to convert to CSV
<dob>1990-01-01</dob><person>  <first>Bob</first>  <last>Johnson</last></person>

Output Example Payload#

{  "data": "example",  "contentType": "text/plain"}

XML to JSON#

Convert XML to JSON | key: xmlToJson

InputKeyNotesExample

Data

text
/ Required
dataXML data to convert to JSON
<dob>1990-01-01</dob><person>  <first>Bob</first>  <last>Johnson</last></person>

Output Example Payload#

{  "data": "example",  "contentType": "text/plain"}

XML to YAML#

Convert XML to YAML | key: xmlToYaml

InputKeyNotesExample

Data

text
/ Required
dataXML data to convert to YAML
<dob>1990-01-01</dob><person>  <first>Bob</first>  <last>Johnson</last></person>

Output Example Payload#

{  "data": "example",  "contentType": "text/plain"}

YAML to CSV#

Convert YAML to CSV | key: yamlToCsv

InputKeyNotesExample

Data

text
/ Required
dataYAML data to convert to CSV
---person:  first: Bob  last: Johnsondob: '1990-01-01'

Output Example Payload#

{  "data": "example",  "contentType": "text/plain"}

YAML to JSON#

Convert YAML to JSON | key: yamlToJson

InputKeyNotesExample

Data

text
/ Required
dataYAML data to convert to JSON
---person:  first: Bob  last: Johnsondob: '1990-01-01'

Output Example Payload#

{  "data": "example",  "contentType": "text/plain"}

YAML to XML#

Convert YAML to XML | key: yamlToXml

InputKeyNotesExample

Data

text
/ Required
dataYAML data to convert to XML
---person:  first: Bob  last: Johnsondob: '1990-01-01'

Output Example Payload#

{  "data": "example",  "contentType": "text/plain"}