Skip to content

Data Set

This module generates a new data object from a configurable schema that allows using dynamic expressions. The schema defines the structure of the output object, where each field can have a static value or a JavaScript expression enclosed in {{...}} that is evaluated with access to the input data. It supports both simple objects and data arrays, including nested subarrays with decorators. It uses lodash for advanced functions within expressions. It is ideal for building custom payloads, transforming complex data structures and preparing data for external APIs.

ParameterTypeRequiredDescription
mapschemastring/objectYesJSON schema that defines the output dataset structure. Can be a JSON string or an object. Values can be static or dynamic expressions with {{...}}.
{
"nextModule": "siguiente_modulo",
"data": {
"id": 123,
"priceWithTax": 60.5,
"detail": [
{ "productName": "PRODUCTO A", "totalPrice": 100 }
]
}
}
{
"mapschema": {
"id": "{{data.id}}",
"priceWithTax": "{{price * 1.21}}",
"uppercaseValue": "{{_.toUpper(data.value)}}",
"detail": [
{
"productName": "{{_.toUpper(item.productName)}}",
"totalPrice": "{{item.price * item.quantity}}"
}
]
}
}
  • Dynamic expressions are defined between double braces: {{expression}}
  • Within expressions you can access data (input data) and _ (lodash)
  • For nested arrays, item is used to refer to the current iteration element
  • If an expression fails, the field is assigned as null and the error is logged
  • The schema can be a JSON string (automatically parsed) or an object
  • Uses the convertSchemaToArrayToObject function to normalize the schema
  • If all fields are processed without errors, it continues to the next module
  • dataMapper (mapping with field rules)
  • dataTransform (transformation with filter schema)
  • dataMapping (mapping from configuration file)