Forum Discussion
We have our own documentation for JSON-Path. There are also online testers, like:
Note that most JSON-Path implementations are only for reading data, whereas we use it for updating and deletions. So,
In the Designer, you should be able to drill down into the document structure in the Mapper and in the drop-down for expression properties.
It’s pretty much the same thing, except instead of checking for value.field1 == null
you can check if value == null
. So, you would write a path to the object whose fields you want to delete (e.g. $.foo.bar
) and then use the filter operator ([?(... expr ...)]
) to select the fields to delete:
$.foo.bar[?(value == null)]
If I have the following in a JSON Generator and a subsequent Mapper, what do I put in the Expression to remove “id” field if its null? I’m getting a parsing error when trying $.id[?(value == null)].
[
{
“id”: 21,
“eId”: [
256,
2,
548,
14010
]
},
{
“id”: null,
“eId”: [
256,
2,
548,
14010
]
}
]