I am looking to locate and insert an additional key in an object within an array using lodash. I want to avoid using a for loop and storing data temporarily.
"book": [
{
"name": "Hulk",
"series": [
{
"name": "mike",
"id": "100",
},
{
"name": "steve",
"id": "200"
}
]
}
],
I need to add the detail
object inside the series
array by searching for name: mike && id:100
, then return the complete data of the book
.
{
"name": "mike",
"id": "100",
"detail":{
"author": 'apple'
"year": 1956
}
},