I have two list of dictionaries. I want to merge them according to a specific key.
Here is list1:
"list1": [
{ "a": "b", "c": "d" },
{ "a": "e", "c": "f" }
]
Here is list2:
"list2": [
{ "a": "e", "g": "h" },
{ "a": "b", "g": "i" }
]
So after merging the final list of dictionaries should look like below. The merging should be done according the value of key "a":
"list3": [
{ "a": "b", "c": "d", "g": "i" },
{ "a": "e", "c": "f", "g": "h" }
]
Official documentation seems not enough for loops, iteration etc. I couldn't find a way to accomplish this task.