acesario
5 years agoContributor II
Remove json object conditionally
I have the following document with question responses. When the response is “-”, I would like to remove the question and answer text. Is there a way to do this in a mapper or conditional step?
B...
- 5 years ago
I used a JSON generator snap with your array of objects at the key
Questions
and a mapper to filter the array with this expression in a mapper:$Questions.filter(value => value.get("answerText") != "-")
This will remove all objects with
answerText
== ‘-’.This relies on the objects having the key
answerText
if that is not the case some additional logic can be added if needed.