AWS Step function for difference between two list of objects with key-value pairs

Consider we have two lists and we need to find difference between them:

ListA :
[
{
“X”: a,
“Y”: b
},
{
“X”: c,
“Y”: d
}
]

ListB :
[
{
“X”: a,
“Y”: b
}
]

Now the difference between these lists should result in
[
{
“X”: c,
“Y”: d
}
]

I have used States.ArrayContains and it worked if the order of keys is always same but there is no guarantee that order of keys in object will be same.

I think one way is to create a lambda, pass these lists and get the difference but is there any way where we can avoid lambda call and do it more efficiently?

Leave a Comment