Forum Discussion
Thank you so much. It worked by creating an empty $array[*].subArray. Do you know where I can learn more about the syntax to use to manipulate JSON like this? I get stuck and spin my wheels a lot on these types of issues.
Also, is there a way to delete just a simple field, not an array/list, with the Mapper if its null like the above expression did for the array? When the right Target path is empty, I’m not sure what expression to use on the left to return the field when its null.
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)]
- koryknick2 years agoEmployee
omiaye - Please download the attached ZIP file, decompress it, and import the SLP as a new pipeline.
The Sequence snap is pretty self-explanatory. We're just getting the list of years we want records for.
In the Mapper, we create both the Jan and Jul start/end dates as a document with and array containing two objects of start/end dates.
Then we use JSON Splitter so each start/end date is a single document.
Finally, the Filter is used to prevent any future dates (i.e. when we're running in the first 6 months of the year.
As with any solution, there are other ways to solve this, and I'm sure others in the Community can come up with a more concise way to do the same, but I wanted to give you an easily supported and understandable solution.
Hope this helps!