I have an object that is structured similar as follows (simplified version):
{
"time": 100,
"complete" : true,
"results" : {
"total": 10,
"score": 3,
"results": [
{
"id" : 123,
"name": "test123"
},
{
"id" : 123,
"name": "test4554"
}
]
}
}
How do I use lodash ._uniqBy to deduplicate the results, based on results.results.id being the unique key?
To clarify, I would like the deduplicated resultset to be returned within the original object structure, e.g.
{
"time": 100,
"complete" : true,
"results" : {
"total": 10,
"score": 3,
"results": [
{
"id" : 123,
"name": "test123"
}
]
}
}
thanks