Skip to main content
Version: ACE 5

JSON Clean

Overview

JSON Clean allows removing nodes from doc context.

This is useful when you want to delete some properties (clean up the doc context) or just remove a couple of properties before returning them in the flow result.

Configuration

  • paths to remove it is possible to add multiple paths to be removed from doc nodes (they will be executed from first to last)
note

Paths can be both upper level node and lower level nodes node.subnode, node.subnode.subnode, etc

Examples

Here we will create a sample flow that has input document with values we want to keep and remove.

note

Please note that the JSON Clean does not have Target path configuration, so in the example flow we have used JSONATA Map to copy all the values in doc context to result

Step configuration

Paths to remove

  • remove
  • object.remove

Input

Input Schema
{
"keep": "Apple",
"remove": "Nails",
"object": {
"keep": "Banana",
"remove": "Screws"
}
}

Result

As you can see the values that were marked in the step as removable were removed.

Input Schema
{
"doc": {
"keep": "Apple",
"object": {
"keep": "Banana"
},
"result": {
"keep": "Apple",
"object": {
"keep": "Banana"
}
}
},
"errors": []
}

Example flow

JSON Clean Example Flow
    tags: []
steps:
- stepType: clean-object
config:
paths:
- removePath: remove
- removePath: object.remove
name: JSON Clean
description: ""
condition: ""
- stepType: jsonata
config:
maps:
- mergeArrayItems: {}
jsonata: $
targetPath: result
name: JSONATA Map
description: ""
condition: ""
sampleData:
keep: Apple
remove: Nails
object:
keep: Banana
remove: Screws