I am exploring JSONAta right now for fun and have a question on how to solve something.
I would like to remove objects from an array that exist in another array based on a match of the entire object (or if that's not possible, match on the Code attribute). For example:
$largerArray := [{"Name": "A", "Code": "100"} ,{"Name": "B", "Code": "200"},{"Name": "C", "Code": "300"}, {"Name": "D", "Code": "400"}];
$objectsToExclude := [{"Name": "A", "Code": "100"} ,{"Name": "B", "Code": "200"},{"Name": "C", "Code": "300"}];
$expectedArray := [{"Name": "D", "Code": "400"}];
So you can see only D is left in the array since A, B, C exist in both arrays.
Is there a way clean way to do this in JSONAta?
I was able to do simple exclusions such as the following:
$sourceArray := [1,2,3,4,5];
$removeArray := [3,4,5];
$result := $sourceArray[$not($ in $removeArray)];
My attempts at doing this with more complex objects is failing.