Remove From Json
Remove an item from the json by path
Description
Removes an element from a JSON object or string specified by the property path.
The path is specified in dotted form. To remove an element inside an array, the property needs to be included inside brackets, e.g. '[name]'.
Examples:
RemoveFromJSON({ "a": { "b": "hello"}, "c": "coucou" }, 'a.b') -> { "a": { }, "c": "coucou" }
RemoveFromJSON({ "a": [ { "b": "hello", c: "boo 1" }, { "b": "coucou" , c: "boo 2" } ] }, 'a.[b]') -> { "a": [ { c: "boo 1" }, { c: "boo 2" } ] }
RemoveFromJSON([{ "name" : "House", "doors" : 2 } , { "name" : "House", "doors" : 4 }], [name] ) -> [ {"doors": 2} , { "doors": 4 } ]
If the path was not found the result would be null and Error Flow would be triggered.
Inputs
- Control Flow (Control Flow)
- Source (Object): JSON object or string
- Path (String): The property path
Outputs
- Control Flow (Control Flow)
- Result (Object): Transformed JSON object
- Error Flow (Error Flow): Triggered by providing incorrect json or path