Skip to content

Data Transform

This module transforms a data object by extracting only the fields specified in a mapping schema. It receives a mapschema in JSON string format that defines a mapping object with the fields to extract. It uses lodash.pick to select only the indicated properties from the input object. It is useful when you need to reduce a large object to only the necessary fields, for example to clean a payload before sending it to an external API or to filter sensitive fields.

ParameterTypeRequiredDescription
mapschemastringYesJSON string containing an object with the mapping property. The mapping keys define the fields to extract from the input object.
{
"nextModule": "siguiente_modulo",
"data": {
"datetime": "2024-01-15T10:30:00",
"utc_datetime": "2024-01-15T09:30:00Z"
}
}
{
"mapschema": "{\"mapping\":{\"datetime\":\"datetime\",\"utc_datetime\":\"utc_datetime\",\"dst_from\":\"dst_from\"}}"
}
  • The mapschema must be a valid JSON string, not an object
  • Only fields whose keys are defined in mapping are extracted
  • Fields that don’t exist in the input data are silently omitted
  • Does not perform field renaming, only selection (uses mapping keys)
  • For renaming fields, use the dataMapper or dataMapping module
  • dataMapper (advanced mapping with expressions and renaming)
  • dataMapping (mapping from configuration file)
  • dataset (data generation with schema)