new_object = FlatJSON(new_object,keys) # flatten original (to match new) old_object = FlatJSON(old_object,keys) # compare new object to old one, remove identical fields. for key in new_object.keys(): if new_object.get(key) == old_object.get(key): new_object.pop(key) #print(old_object) # if there are any different fields, patch them. SHOULD ALLOW FOR USER TO VIEW/APPROVE DIFFERENCES if new_object: # inform user of the updates print(object_id + ' has updates.') # patch each field to object individually for key,value in new_object.items(): patch_single = {} patch_single[key] = value print(patch_single) response = patch_ENCODE(object_id,patch_single,keys) # inform user there are no updates # else: # print(object_id + ' has no updates.') print('Done. ')