Data Transform
CSV, JSON, XML, YAML parsing, generation, and pipeline transformations.
16 modules
| Module | Description |
|---|---|
| Leer archivo CSV | Leer y parsear archivo CSV en array de objetos |
| Escribir archivo CSV | Escribir array de objetos a archivo CSV |
| Parsear JSON | Parsear cadena JSON a objeto |
| Convertir a JSON | Convertir objeto a cadena JSON |
| JSON a CSV | Convertir datos JSON o archivos a formato CSV |
| Tubería de Datos | Encadena múltiples transformaciones de datos en un solo paso |
| Plantilla de texto | Llenar plantilla de texto con variables |
| Generar XML | Generar cadena XML desde objeto o arreglo |
| Analizar XML | Analizar cadena XML en objeto |
| Generar YAML | Generar cadena YAML desde objeto o arreglo |
| Analizar YAML | Analizar cadena YAML en objeto |
| Claves de objeto | Obtener todas las claves de un objeto |
| Combinar objetos | Combinar multiples objetos en uno |
| Omitir de objeto | Omitir claves especificas de un objeto |
| Seleccionar de objeto | Seleccionar claves especificas de un objeto |
| Valores de objeto | Obtener todos los valores de un objeto |
Modules
Leer archivo CSV
data.csv.read
Leer y parsear archivo CSV en array de objetos
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
path | string | Yes | - | Path to the file |
delimiter | select (,, ;, , ` | , `) | No | , |
encoding | select (utf-8, ascii, latin-1, utf-16, gbk, big5) | No | utf-8 | Character encoding for the file |
skip_header | boolean | No | False | Skip first row (header) |
Output:
| Field | Type | Description |
|---|---|---|
status | string | Estado de la operacion |
data | array | Estado de la operacion |
rows | number | Estado de la operacion |
columns | array | Array de objetos de fila |
Example: Example
file_path: data/users.csv
delimiter: ,
encoding: utf-8Escribir archivo CSV
data.csv.write
Escribir array de objetos a archivo CSV
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
path | string | Yes | - | Path to the file |
data | array | Yes | - | Array of data items to process |
delimiter | select (,, ;, , ` | , `) | No | , |
encoding | select (utf-8, ascii, latin-1, utf-16, gbk, big5) | No | utf-8 | Character encoding for the file |
Output:
| Field | Type | Description |
|---|---|---|
status | string | Estado de la operacion |
file_path | string | Estado de la operacion |
rows_written | number | Estado de la operacion |
Example: Example
file_path: output/results.csv
data: [{"name": "John", "score": 95}, {"name": "Jane", "score": 87}]Parsear JSON
data.json.parse
Parsear cadena JSON a objeto
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
json_string | string | Yes | - | JSON string to parse into an object or array |
Output:
| Field | Type | Description |
|---|---|---|
status | string | Estado de la operacion |
data | object | Estado de la operacion |
Example: Example
json_string: {"name": "John", "age": 30}Convertir a JSON
data.json.stringify
Convertir objeto a cadena JSON
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
data | object | Yes | - | Data object to process |
pretty | boolean | No | False | Format with indentation |
indent | number | No | 2 | Indentation spaces (if pretty=true) |
Output:
| Field | Type | Description |
|---|---|---|
status | string | Estado de la operacion |
json | string | Estado de la operacion |
Example: Example
data: {"name": "John", "age": 30}
pretty: trueJSON a CSV
data.json_to_csv
Convertir datos JSON o archivos a formato CSV
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
input_data | any | Yes | - | JSON data (array of objects) or path to JSON file |
output_path | string | No | /tmp/output.csv | Path where the output file will be saved |
delimiter | select (,, ;, , ` | , `) | No | , |
include_header | boolean | No | True | Include column headers in first row |
flatten_nested | boolean | No | True | Flatten nested objects using dot notation (e.g., address.city) |
columns | array | No | [] | Specific columns to include (empty = all columns) |
Output:
| Field | Type | Description |
|---|---|---|
output_path | string | Ruta al archivo CSV generado |
row_count | number | Ruta al archivo CSV generado |
column_count | number | Ruta al archivo CSV generado |
columns | array | Numero de filas escritas |
Example: Convert JSON array to CSV
input_data: [{"name": "Alice", "age": 30}, {"name": "Bob", "age": 25}]
output_path: /tmp/users.csvExample: Convert JSON file
input_data: /path/to/data.json
output_path: /path/to/output.csvTubería de Datos
data.pipeline
Encadena múltiples transformaciones de datos en un solo paso
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
input | any | Yes | - | Datos de entrada para transformar (arreglo u objeto) |
steps | array | Yes | - | Datos de entrada para transformar (arreglo u objeto) |
Output:
| Field | Type | Description |
|---|---|---|
result | any | Arreglo de pasos de transformación a aplicar en orden |
original_count | integer | Datos transformados |
result_count | integer | Datos transformados |
steps_applied | integer | Cantidad de elementos después de la transformación |
Example: Example
input: ${input.users}
steps: [{"filter": {"field": "active", "condition": "eq", "value": true}}, {"sort": {"field": "name", "order": "asc"}}]Example: Example
input: ${input.records}
steps: [{"map": {"extract": "id"}}, {"limit": 10}]Example: Example
input: ${input.data}
steps: [{"filter": {"field": "status", "condition": "eq", "value": "completed"}}, {"pick": ["id", "name", "timestamp"]}, {"sort": {"field": "timestamp", "order": "desc"}}, {"skip": 5}, {"limit": 20}]Plantilla de texto
data.text.template
Llenar plantilla de texto con variables
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
template | string | Yes | - | Text template with {variable} placeholders |
variables | object | Yes | - | Object with variable values |
Output:
| Field | Type | Description |
|---|---|---|
status | string | Estado de la operacion |
result | string | Estado de la operacion |
Example: Example
template: Hello {name}, you scored {score} points!
variables: {"name": "Alice", "score": 95}Generar XML
data.xml.generate
Generar cadena XML desde objeto o arreglo
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
data | object | Yes | - | Datos a convertir a XML |
root_tag | string | No | root | Nombre de la etiqueta del elemento raíz |
pretty | boolean | No | True | Formato bonito para la salida XML |
encoding | string | No | utf-8 | Codificación de caracteres para la salida XML |
declaration | boolean | No | True | Incluir encabezado de declaración XML |
Output:
| Field | Type | Description |
|---|---|---|
xml | string | Cadena XML generada |
Example: Example
data: {"user": {"@attributes": {"id": "1"}, "name": "John", "age": "30"}}
root_tag: users
pretty: trueAnalizar XML
data.xml.parse
Analizar cadena XML en objeto
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
content | string | No | - | Cadena XML a analizar |
file_path | string | No | - | Ruta al archivo XML a analizar |
preserve_attributes | boolean | No | True | Preservar atributos XML en la salida analizada |
Output:
| Field | Type | Description |
|---|---|---|
result | object | XML analizado como objeto |
root_tag | string | Nombre de la etiqueta del elemento raíz |
Example: Example
content: <users><user id="1"><name>John</name></user></users>
preserve_attributes: trueGenerar YAML
data.yaml.generate
Generar cadena YAML desde objeto o arreglo
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
data | any | Yes | - | Datos a convertir a YAML |
default_flow_style | boolean | No | False | Usar estilo de flujo para estructuras anidadas |
sort_keys | boolean | No | False | Ordenar claves alfabéticamente |
indent | number | No | 2 | Número de espacios para la indentación |
allow_unicode | boolean | No | True | Permitir caracteres unicode en la salida |
Output:
| Field | Type | Description |
|---|---|---|
yaml | string | Cadena YAML generada |
Example: Example
data: {"name": "John", "age": 30, "cities": ["NYC", "LA"]}
sort_keys: false
indent: 2Analizar YAML
data.yaml.parse
Analizar cadena YAML en objeto
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
content | string | No | - | Cadena YAML a analizar |
file_path | string | No | - | Ruta al archivo YAML a analizar |
multi_document | boolean | No | False | Analizar YAML de múltiples documentos (separados por ---) |
Output:
| Field | Type | Description |
|---|---|---|
result | any | YAML analizado como objeto o arreglo |
type | string | Tipo del resultado analizado |
Example: Example
content: name: John
age: 30
cities:
- NYC
- LA
multi_document: falseExample: Example
content: ---
name: John
---
name: Jane
multi_document: trueClaves de objeto
object.keys
Obtener todas las claves de un objeto
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
object | object | Yes | - | Input object/dictionary |
Output:
| Field | Type | Description |
|---|---|---|
keys | array | Lista de claves del objeto |
count | number | Lista de claves del objeto |
Example: Get object keys
object: {"name": "John", "age": 30, "city": "NYC"}Combinar objetos
object.merge
Combinar multiples objetos en uno
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
objects | array | Yes | - | Array of objects to process |
Output:
| Field | Type | Description |
|---|---|---|
result | object | Objeto combinado |
Example: Merge user data
objects: [{"name": "John", "age": 30}, {"city": "NYC", "country": "USA"}, {"job": "Engineer"}]Omitir de objeto
object.omit
Omitir claves especificas de un objeto
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
object | object | Yes | - | Input object/dictionary |
keys | array | Yes | - | Keys to pick or omit |
Output:
| Field | Type | Description |
|---|---|---|
result | object | Objeto sin claves omitidas |
Example: Omit sensitive fields
object: {"name": "John", "age": 30, "password": "secret", "ssn": "123-45-6789"}
keys: ["password", "ssn"]Seleccionar de objeto
object.pick
Seleccionar claves especificas de un objeto
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
object | object | Yes | - | Input object/dictionary |
keys | array | Yes | - | Keys to pick or omit |
Output:
| Field | Type | Description |
|---|---|---|
result | object | Objeto con solo claves seleccionadas |
Example: Pick user fields
object: {"name": "John", "age": 30, "email": "john@example.com", "password": "secret"}
keys: ["name", "email"]Valores de objeto
object.values
Obtener todos los valores de un objeto
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
object | object | Yes | - | Input object/dictionary |
Output:
| Field | Type | Description |
|---|---|---|
values | array | Lista de valores del objeto |
count | number | Lista de valores del objeto |
Example: Get object values
object: {"name": "John", "age": 30, "city": "NYC"}