How can I merge dictionaries within the list with the some properties that are the same and have the values of the properties that are different added to a list value of merged dictionary?
[
{
"name": "samename",
"content": "content1"
},
{
"name": "samename",
"content": "content2"
},
{
"name": "differentname",
"content": "content3"
}
]
Desired output:
[
{
"name": "samename",
"content": ["content1", "content2"]
},
{
"name": "differentname",
"content": "content3"
}
]