Skip to main content
Version: ACE 4

JSONATA Map

Overview​

JSONATA Map allows performing advanced manipulations on the doc nodes using the JSONATA Query Language.

tip

It is possible to explore the possibilities of JSONATA using Web Editor

Configuration​

It is possible to define multiple JSONATA mappings with following variables:

  • Jsonata - a jsonata string for mapping from doc nodes
  • Target path - node on doc context where to place the outcome
  • when enrich result is null - if set to true then map to target with null value. by default will not map null values
  • append - when set to true the result will be appended to the target path making the target path an array

Merge Array Items​

An optional config to merge items in source and target arrays. The items of both arrays have to be in the same structure.

  • key - find items to merge by this key
  • jsonata - an optional jsonata expression to exclude items in the target when merging

Examples​

Aggregation​

Step configuration

InputValue
Jsonata{ "total": $sum(cart.(price * quantity)) }
Target pathresult
Input Schema
{
"cart": [
{
"price": 100,
"quantity": 10
},
{
"price": 120,
"quantity": 20
},
{
"price": 200,
"quantity": 5
},
{
"price": 500,
"quantity": 3
}
]
}
Flow Result
{
"doc": {
"cart": [
{
"price": 100,
"quantity": 10
},
{
"price": 120,
"quantity": 20
},
{
"price": 200,
"quantity": 5
},
{
"price": 500,
"quantity": 3
}
],
"result": {
"total": 5900
}
},
"errors": [],
"performance": {
"steps": [
{
"step": "jsonata",
"executionTime": 1
}
],
"executionTimeOfFlow": 1,
"timeMetric": "ms"
}
}
JSONATA Map Example Flow
{
"id": "1968cff9-0ee0-44b2-a73f-db0d2dfb8d63",
"name": "exampleJsonataMap",
"flow": {
"name": "exampleJsonataMap",
"description": "",
"steps": [
{
"stepType": "jsonata",
"color": "rgb(245,210,211)",
"displayName": "JSONATA Map",
"isSelected": true,
"config": {
"maps": [
{
"mergeArrayItems": {},
"jsonata": "{ \"total\": $sum(cart.(price * quantity)) }",
"targetPath": "result"
}
]
}
}
]
},
"inputSchema": {
"cart": [
{
"price": 100,
"quantity": 10
},
{
"price": 120,
"quantity": 20
},
{
"price": 200,
"quantity": 5
},
{
"price": 500,
"quantity": 3
}
]
},
"createDate": "2021-10-08T20:45:56.836Z",
"tags": [
"general"
],
"inputSchemaLabel": "",
"version": 1
}