I have two json object and i want to merge it. it means ifsame key is there then want to overwrite it. How I can do it using node.js. kindly check below sample:
first object
{
"title": "Test",
"url": "/test",
"gf": {
"name": "kim",
"last": "john"
},
"created_at": "2021-09-08T18:40:50.152Z",
"updated_at": "2021-09-08T18:54:36.387Z",
"version": 9
}
Second Object
{
"gf": {
"last": "Anup"
},
"__originalParams": {
"gf": {
"last": "Anup"
}
}
}
Required Result
{
"title": "Test",
"url": "/test",
"gf": {
"name": "kim",
"last": "Anup"
},
"created_at": "2021-09-08T18:40:50.152Z",
"updated_at": "2021-09-08T18:54:36.387Z",
"version": 9,
"__originalParams": {
"gf": {
"last": "Anup"
}
}
}
How I get this result using node.js . It is just a sample I have complex JSON structure too. is any direct option present in Lodash or Ramda for this. Kindly help me here