Forum Discussion

kmiesse's avatar
kmiesse
Contributor
8 years ago
Solved

Delete Array or Create Empty Array Based on Expression

If I have the following, [{ "fieldType": null, "array": [{ "fieldA": null, "subArray": [{ "field1": null }] }] }, { "fieldType": null, "array": [{ "fieldA": null, "subArray": [{ ...
  • tstack's avatar
    8 years ago

    You might want to look at this post that had a similar request.

    In short, you can use a Mapper with a JSON-Path in the left field of a mapping row with an empty right field to delete all elements on the path. In this case, you’d probably use a path like the following:

    $array[*].subArray[?(value.field1 == null)]

    Make sure you have the ‘Passthrough’ option enabled in the Mapper.