我有两个 json 对象,如下所示:
obj1= [ { "id": 4, "userId": "abc", "firstName": "abc", "lastName": "abc", "email": "abc@abc.it", "prefers" : [{"breakfast" : "bread" , "lunch" : "non-veg"}] } ]
obj2= [ { "id": 5, "userId": "def", "firstName": "def", "lastName": "def", "email": "def@def.it", "prefers" : [{"breakfast" : "egg" , "lunch" : "veg"}] } ]
鉴于这些对象,我必须验证 object2 具有与 object1 中相同的键
diff(obj1,obj2)
应该给我丢失的钥匙