I'm struggling to find a clean way to reduce or filter an array to contain no duplicate set values, when 2 of the values match. Here is an example of the data I am using. I am trying to remove any duplicates where title && genre both match.
[
{
"title": "american-hustle",
"genre": "arts",
"user": "penny"
},
{
"title": "american-hustle",
"genre": "comedy",
"user": "brian"
},
{
"title": "platoon",
"genre": "war",
"user": "tom"
},
{
"title": "american-hustle",
"genre": "arts",
"user": "sarah"
},
{
"title": "american-hustle",
"genre": "arts",
"user": "john"
}
]
So in this case, the final two items should be removed, as both title && genre match that of an existing entry. Note, the second item should remain as american-hustle with a genre comedy, is still unique.
I've tried to find a similar question but I'm struggling to find one. Any help would be greatly appreciated.