Skip to content

Data Transform

CSV, JSON, XML, YAML parsing, generation, and pipeline transformations.

16 modules

ModuleDescription
Read CSV FileRead and parse CSV file into array of objects
Write CSV FileWrite array of objects to CSV file
Parse JSONParse JSON string into object
JSON StringifyConvert object to JSON string
JSON to CSVConvert JSON data or files to CSV format
Data PipelineChain multiple data transformations in a single step
Text TemplateFill text template with variables
Generate XMLGenerate XML string from object or array
Parse XMLParse XML string into object
Generate YAMLGenerate YAML string from object or array
Parse YAMLParse YAML string into object
Object KeysGet all keys from an object
Object MergeMerge multiple objects into one
Object OmitOmit specific keys from an object
Object PickPick specific keys from an object
Object ValuesGet all values from an object

Modules

Read CSV File

data.csv.read

Read and parse CSV file into array of objects

Parameters:

NameTypeRequiredDefaultDescription
pathstringYes-Path to the file
delimiterselect (,, ;, , `, `)No,
encodingselect (utf-8, ascii, latin-1, utf-16, gbk, big5)Noutf-8Character encoding for the file
skip_headerbooleanNoFalseSkip first row (header)

Output:

FieldTypeDescription
statusstringOperation status
dataarrayOperation status
rowsnumberOperation status
columnsarrayArray of row objects

Example: Example

yaml
file_path: data/users.csv
delimiter: ,
encoding: utf-8

Write CSV File

data.csv.write

Write array of objects to CSV file

Parameters:

NameTypeRequiredDefaultDescription
pathstringYes-Path to the file
dataarrayYes-Array of data items to process
delimiterselect (,, ;, , `, `)No,
encodingselect (utf-8, ascii, latin-1, utf-16, gbk, big5)Noutf-8Character encoding for the file

Output:

FieldTypeDescription
statusstringOperation status
file_pathstringOperation status
rows_writtennumberOperation status

Example: Example

yaml
file_path: output/results.csv
data: [{"name": "John", "score": 95}, {"name": "Jane", "score": 87}]

Parse JSON

data.json.parse

Parse JSON string into object

Parameters:

NameTypeRequiredDefaultDescription
json_stringstringYes-JSON string to parse into an object or array

Output:

FieldTypeDescription
statusstringOperation status
dataobjectOperation status

Example: Example

yaml
json_string: {"name": "John", "age": 30}

JSON Stringify

data.json.stringify

Convert object to JSON string

Parameters:

NameTypeRequiredDefaultDescription
dataobjectYes-Data object to process
prettybooleanNoFalseFormat with indentation
indentnumberNo2Indentation spaces (if pretty=true)

Output:

FieldTypeDescription
statusstringOperation status
jsonstringOperation status

Example: Example

yaml
data: {"name": "John", "age": 30}
pretty: true

JSON to CSV

data.json_to_csv

Convert JSON data or files to CSV format

Parameters:

NameTypeRequiredDefaultDescription
input_dataanyYes-JSON data (array of objects) or path to JSON file
output_pathstringNo/tmp/output.csvPath where the output file will be saved
delimiterselect (,, ;, , `, `)No,
include_headerbooleanNoTrueInclude column headers in first row
flatten_nestedbooleanNoTrueFlatten nested objects using dot notation (e.g., address.city)
columnsarrayNo[]Specific columns to include (empty = all columns)

Output:

FieldTypeDescription
output_pathstringPath to the generated CSV file
row_countnumberPath to the generated CSV file
column_countnumberPath to the generated CSV file
columnsarrayNumber of rows written

Example: Convert JSON array to CSV

yaml
input_data: [{"name": "Alice", "age": 30}, {"name": "Bob", "age": 25}]
output_path: /tmp/users.csv

Example: Convert JSON file

yaml
input_data: /path/to/data.json
output_path: /path/to/output.csv

Data Pipeline

data.pipeline

Chain multiple data transformations in a single step

Parameters:

NameTypeRequiredDefaultDescription
inputanyYes-Input data to transform (array or object)
stepsarrayYes-Input data to transform (array or object)

Output:

FieldTypeDescription
resultanyArray of transformation steps to apply in order
original_countintegerTransformed data
result_countintegerTransformed data
steps_appliedintegerCount of items after transformation

Example: Example

yaml
input: ${input.users}
steps: [{"filter": {"field": "active", "condition": "eq", "value": true}}, {"sort": {"field": "name", "order": "asc"}}]

Example: Example

yaml
input: ${input.records}
steps: [{"map": {"extract": "id"}}, {"limit": 10}]

Example: Example

yaml
input: ${input.data}
steps: [{"filter": {"field": "status", "condition": "eq", "value": "completed"}}, {"pick": ["id", "name", "timestamp"]}, {"sort": {"field": "timestamp", "order": "desc"}}, {"skip": 5}, {"limit": 20}]

Text Template

data.text.template

Fill text template with variables

Parameters:

NameTypeRequiredDefaultDescription
templatestringYes-Text template with {variable} placeholders
variablesobjectYes-Object with variable values

Output:

FieldTypeDescription
statusstringOperation status
resultstringOperation status

Example: Example

yaml
template: Hello {name}, you scored {score} points!
variables: {"name": "Alice", "score": 95}

Generate XML

data.xml.generate

Generate XML string from object or array

Parameters:

NameTypeRequiredDefaultDescription
dataobjectYes-Data to convert to XML
root_tagstringNorootRoot element tag name
prettybooleanNoTruePretty-print the XML output
encodingstringNoutf-8Character encoding for the XML output
declarationbooleanNoTrueInclude XML declaration header

Output:

FieldTypeDescription
xmlstringGenerated XML string

Example: Example

yaml
data: {"user": {"@attributes": {"id": "1"}, "name": "John", "age": "30"}}
root_tag: users
pretty: true

Parse XML

data.xml.parse

Parse XML string into object

Parameters:

NameTypeRequiredDefaultDescription
contentstringNo-XML string to parse
file_pathstringNo-Path to XML file to parse
preserve_attributesbooleanNoTruePreserve XML attributes in parsed output

Output:

FieldTypeDescription
resultobjectParsed XML as object
root_tagstringRoot element tag name

Example: Example

yaml
content: <users><user id="1"><name>John</name></user></users>
preserve_attributes: true

Generate YAML

data.yaml.generate

Generate YAML string from object or array

Parameters:

NameTypeRequiredDefaultDescription
dataanyYes-Data to convert to YAML
default_flow_stylebooleanNoFalseUse flow style for nested structures
sort_keysbooleanNoFalseSort keys alphabetically
indentnumberNo2Number of spaces for indentation
allow_unicodebooleanNoTrueAllow unicode characters in output

Output:

FieldTypeDescription
yamlstringGenerated YAML string

Example: Example

yaml
data: {"name": "John", "age": 30, "cities": ["NYC", "LA"]}
sort_keys: false
indent: 2

Parse YAML

data.yaml.parse

Parse YAML string into object

Parameters:

NameTypeRequiredDefaultDescription
contentstringNo-YAML string to parse
file_pathstringNo-Path to YAML file to parse
multi_documentbooleanNoFalseParse multi-document YAML (separated by ---)

Output:

FieldTypeDescription
resultanyParsed YAML as object or array
typestringType of the parsed result

Example: Example

yaml
content: name: John
age: 30
cities:
  - NYC
  - LA
multi_document: false

Example: Example

yaml
content: ---
name: John
---
name: Jane
multi_document: true

Object Keys

object.keys

Get all keys from an object

Parameters:

NameTypeRequiredDefaultDescription
objectobjectYes-Input object/dictionary

Output:

FieldTypeDescription
keysarrayList of object keys
countnumberList of object keys

Example: Get object keys

yaml
object: {"name": "John", "age": 30, "city": "NYC"}

Object Merge

object.merge

Merge multiple objects into one

Parameters:

NameTypeRequiredDefaultDescription
objectsarrayYes-Array of objects to process

Output:

FieldTypeDescription
resultobjectMerged object

Example: Merge user data

yaml
objects: [{"name": "John", "age": 30}, {"city": "NYC", "country": "USA"}, {"job": "Engineer"}]

Object Omit

object.omit

Omit specific keys from an object

Parameters:

NameTypeRequiredDefaultDescription
objectobjectYes-Input object/dictionary
keysarrayYes-Keys to pick or omit

Output:

FieldTypeDescription
resultobjectObject without omitted keys

Example: Omit sensitive fields

yaml
object: {"name": "John", "age": 30, "password": "secret", "ssn": "123-45-6789"}
keys: ["password", "ssn"]

Object Pick

object.pick

Pick specific keys from an object

Parameters:

NameTypeRequiredDefaultDescription
objectobjectYes-Input object/dictionary
keysarrayYes-Keys to pick or omit

Output:

FieldTypeDescription
resultobjectObject with only picked keys

Example: Pick user fields

yaml
object: {"name": "John", "age": 30, "email": "john@example.com", "password": "secret"}
keys: ["name", "email"]

Object Values

object.values

Get all values from an object

Parameters:

NameTypeRequiredDefaultDescription
objectobjectYes-Input object/dictionary

Output:

FieldTypeDescription
valuesarrayList of object values
countnumberList of object values

Example: Get object values

yaml
object: {"name": "John", "age": 30, "city": "NYC"}

Released under the Apache 2.0 License.