问题
I have the below two responses, I need to check whether the res1.member.part[0].supportedMembers[*].muid == res2.membersSupported[*].member.muid
(order of the elements are not same). Tried out different things but nothing is working out for me. Any help would be greatly appreciated!
* def res1 = {"member":{"muid":"MBR1"},"part":[{"PID":"M123"},{"supportedMembers":[{"muid":"MBR3","status":{"code":"A"}},{"muid":"MBR2","status":{"code":"I"}}]}]}
* def res2 = {"members":[{"member":{"muid":"MBR2","test":[{"EID":"E123"}]}},{"member":{"muid":"MBR3","test":[{"EID":"E123"}]}}]}
回答1:
Here you go:
* match res1.part[1].supportedMembers[*].muid contains only $res2.members[*]..muid
Also note that you can use ..
to simplify things in some cases.
来源:https://stackoverflow.com/questions/60402036/karate-match-array-elements-of-two-different-json