Forum Discussion
The Mapper can delete fields based on a JSON-Path and you can do quite a bit with JSON-Path. If you wanted to delete fields whose values were null, you could add a Mapper, set “Pass through” to true, and add one row with this expression:
$…[?(value == null)]
Note that there is nothing in the ‘Target Path’ column for this row.
Here’s a breakdown of the JSON-Path:
$… - This tells the mapper to walk the entire JSON object hierarchy.
[?(value == null)] - This is a conditional that tells the mapper to visit only those fields whose value is null.
- IgnatiusN8 years agoNew Contributor II
Thanks. We wanted to take advantage of the data validator snap’s error output ability. We ended up adding a mapper in front of the data validator snap to convert them to boolean strings (“true”/“false”) and using the pattern matching on data validator.
It would be good to have some clarity on how “Required” works. According to the documentation “Required” should work for all data types. We also tried to validate the date using “Type” validation for “date”, that didn’t work too.
The validator appears to be working good only for string types.