Python: Merge two lists of dictionaries
Perhaps the simplest option result = {x[‘id’]:x for x in lst1 + lst2}.values() This keeps only unique ids in the list, not preserving the order though. If the lists are really big, a more realistic solution would be to sort them by id and merge iteratively.