Skip to main content
Version: ACE 5

Key Name Transform

Overview

Key name transform allows transforming input using a predefined model. It uses JSONATA Map as the parsing library, so transformations can use JSONATA Queries/Functions. If the provided path contains array of objects the Key Name Transform will loop through the objects and modify values in each of them.

Configuration

  • Mapper Object - Configuration in JSON format providing the new structure and defaults
  • Target path - doc node on which to run the mapper (this node should contain the data needed to be transformed)
Example Mapper Object
{
"model": {
"propertyNameOnNewObject": "propertyNameOnOldObject"
},
"defaults": {
"booleanPropertyNameOnNewObject": "$boolean(isCovered) or $boolean(false)",
"propertyNameOnNewObject": "'value'"
}
}

Examples

Flow Input

Example Input
[
{
"name": "John",
"surname": "Doe",
"isCovered": true
},
{
"name": "Jane",
"surname": "Doe"
}
]

Mapper Object

Here we utilize JSONATA to combine name and surname to from full name as well as attach default value to isCovered to be false. And add a property type of value person to the object.

Example Mapper Object
{
"model": {
"fullName": "name & ' ' & surname"
},
"defaults": {
"isCovered": "$boolean(isCovered) or $boolean(false)",
"type": "'person'"
}
}

Result

Example Result
{
"doc": {
"input": [
{
"fullName": "John Doe",
"isCovered": true,
"type": "person"
},
{
"fullName": "Jane Doe",
"isCovered": false,
"type": "person"
}
]
},
"errors": [],
"performance": {
"steps": [
{
"step": "input-transform",
"executionTime": 0
},
{
"step": "transform",
"executionTime": 2
}
],
"executionTimeOfFlow": 2,
"timeMetric": "ms"
}
}

Flow Configuration

Example flow Configuration
    tags:
- general
steps:
- stepType: input-transform
config:
key: input
name: Input Transform
description: ""
condition: ""
- stepType: transform
config:
targetPath: input
mapper: |-
{
"model": {
"fullName": "name & ' ' & surname"
},
"defaults": {
"isCovered": "$boolean(isCovered) or $boolean(false)",
"type": "'person'"
}
}
name: Key-name Transform
description: ""
condition: ""
sampleData:
- name: John
surname: Doe
isCovered: true
- name: Jane
surname: Doe