I got the following json:
[
{
"course": {
"active": true,
"abstract": "abstract",
"display_title": "Display title",
"completed_at": "2019-08-30",
"document": "/course/certificate/1/",
},
{
"course": {
"active": true,
"abstract": "abstract",
"display_title": "ANOTHER title",
"completed_at": "2019-09-08",
"document": "/course/certificate/3/",
},
{
"course": {
"active": true,
"abstract": "abstract",
"display_title": "Display title",
"completed_at": "2019-09-08",
"document": "/course/certificate/3/",
}
]
from this I want to create a new list that do not contains any duplicates based on course.display_title. So if an array in the list allready exist with that course.display_title that whole array should be gone.
So the end result from above should be:
[
{
"course": {
"active": true,
"abstract": "abstract",
"display_title": "Display title",
"completed_at": "2019-08-30",
"document": "/course/certificate/1/",
},
{
"course": {
"active": true,
"abstract": "abstract",
"display_title": "ANOTHER title",
"completed_at": "2019-09-08",
"document": "/course/certificate/3/",
}]
So the third item should not be in the list since the first have the same display_title as it does.
I have tried some filter and map function but they only return all the unique titles and not everything else that belongs in that array.