Skip to content

Data Transform

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

16 modules

ModuleDescription
Leggi File CSVLeggi e analizza file CSV in array di oggetti
Scrivi File CSVScrivi array di oggetti su file CSV
Analizza JSONAnalizza stringa JSON in oggetto
Serializza JSONConverti oggetto in stringa JSON
JSON a CSVConverti dati o file JSON in formato CSV
Pipeline di DatiCollega più trasformazioni di dati in un unico passaggio
Template TestoCompila template di testo con variabili
Genera XMLGenera stringa XML da oggetto o array
Analizza XMLAnalizza stringa XML in oggetto
Genera YAMLGenera stringa YAML da oggetto o array
Analizza YAMLAnalizza stringa YAML in oggetto
Chiavi OggettoOttieni tutte le chiavi da un oggetto
Unione OggettiUnisci piu oggetti in uno
Ometti Chiavi OggettoOmetti chiavi specifiche da un oggetto
Seleziona Chiavi OggettoSeleziona chiavi specifiche da un oggetto
Valori OggettoOttieni tutti i valori da un oggetto

Modules

Leggi File CSV

data.csv.read

Leggi e analizza file CSV in array di oggetti

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
statusstringStato operazione
dataarrayStato operazione
rowsnumberStato operazione
columnsarrayArray di oggetti riga

Example: Example

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

Scrivi File CSV

data.csv.write

Scrivi array di oggetti su file CSV

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
statusstringStato operazione
file_pathstringStato operazione
rows_writtennumberStato operazione

Example: Example

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

Analizza JSON

data.json.parse

Analizza stringa JSON in oggetto

Parameters:

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

Output:

FieldTypeDescription
statusstringStato operazione
dataobjectStato operazione

Example: Example

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

Serializza JSON

data.json.stringify

Converti oggetto in stringa JSON

Parameters:

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

Output:

FieldTypeDescription
statusstringStato operazione
jsonstringStato operazione

Example: Example

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

JSON a CSV

data.json_to_csv

Converti dati o file JSON in formato CSV

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_pathstringPercorso del file CSV generato
row_countnumberPercorso del file CSV generato
column_countnumberPercorso del file CSV generato
columnsarrayNumero di righe scritte

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

Pipeline di Dati

data.pipeline

Collega più trasformazioni di dati in un unico passaggio

Parameters:

NameTypeRequiredDefaultDescription
inputanyYes-Dati di input da trasformare (array o oggetto)
stepsarrayYes-Dati di input da trasformare (array o oggetto)

Output:

FieldTypeDescription
resultanyArray di passaggi di trasformazione da applicare in ordine
original_countintegerDati trasformati
result_countintegerDati trasformati
steps_appliedintegerConteggio degli elementi dopo la trasformazione

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}]

Template Testo

data.text.template

Compila template di testo con variabili

Parameters:

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

Output:

FieldTypeDescription
statusstringStato operazione
resultstringStato operazione

Example: Example

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

Genera XML

data.xml.generate

Genera stringa XML da oggetto o array

Parameters:

NameTypeRequiredDefaultDescription
dataobjectYes-Dati da convertire in XML
root_tagstringNorootNome del tag dell'elemento radice
prettybooleanNoTrueStampa formattata dell'output XML
encodingstringNoutf-8Codifica dei caratteri per l'output XML
declarationbooleanNoTrueIncludi intestazione di dichiarazione XML

Output:

FieldTypeDescription
xmlstringStringa XML generata

Example: Example

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

Analizza XML

data.xml.parse

Analizza stringa XML in oggetto

Parameters:

NameTypeRequiredDefaultDescription
contentstringNo-Stringa XML da analizzare
file_pathstringNo-Percorso del file XML da analizzare
preserve_attributesbooleanNoTrueConserva attributi XML nell'output analizzato

Output:

FieldTypeDescription
resultobjectXML analizzato come oggetto
root_tagstringNome del tag dell'elemento radice

Example: Example

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

Genera YAML

data.yaml.generate

Genera stringa YAML da oggetto o array

Parameters:

NameTypeRequiredDefaultDescription
dataanyYes-Dati da convertire in YAML
default_flow_stylebooleanNoFalseUsa stile a flusso per strutture nidificate
sort_keysbooleanNoFalseOrdina le chiavi alfabeticamente
indentnumberNo2Numero di spazi per l'indentazione
allow_unicodebooleanNoTruePermetti caratteri unicode nell'output

Output:

FieldTypeDescription
yamlstringStringa YAML generata

Example: Example

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

Analizza YAML

data.yaml.parse

Analizza stringa YAML in oggetto

Parameters:

NameTypeRequiredDefaultDescription
contentstringNo-Stringa YAML da analizzare
file_pathstringNo-Percorso del file YAML da analizzare
multi_documentbooleanNoFalseAnalizza YAML multi-documento (separato da ---)

Output:

FieldTypeDescription
resultanyYAML analizzato come oggetto o array
typestringTipo del risultato analizzato

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

Chiavi Oggetto

object.keys

Ottieni tutte le chiavi da un oggetto

Parameters:

NameTypeRequiredDefaultDescription
objectobjectYes-Input object/dictionary

Output:

FieldTypeDescription
keysarrayLista delle chiavi oggetto
countnumberLista delle chiavi oggetto

Example: Get object keys

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

Unione Oggetti

object.merge

Unisci piu oggetti in uno

Parameters:

NameTypeRequiredDefaultDescription
objectsarrayYes-Array of objects to process

Output:

FieldTypeDescription
resultobjectOggetto unito

Example: Merge user data

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

Ometti Chiavi Oggetto

object.omit

Ometti chiavi specifiche da un oggetto

Parameters:

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

Output:

FieldTypeDescription
resultobjectOggetto senza chiavi omesse

Example: Omit sensitive fields

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

Seleziona Chiavi Oggetto

object.pick

Seleziona chiavi specifiche da un oggetto

Parameters:

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

Output:

FieldTypeDescription
resultobjectOggetto con solo chiavi selezionate

Example: Pick user fields

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

Valori Oggetto

object.values

Ottieni tutti i valori da un oggetto

Parameters:

NameTypeRequiredDefaultDescription
objectobjectYes-Input object/dictionary

Output:

FieldTypeDescription
valuesarrayLista dei valori oggetto
countnumberLista dei valori oggetto

Example: Get object values

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

Released under the Apache 2.0 License.