There are multiple objects in an array in js. How to replace one property of one object with another object in batch?

this is the data list
list: that I got from the backstage.
{
lastKnowsAnswers: {avelle, name: letter of guarantee,
pGoodsAdvice:, < id: 101, name: "guarantee"}, {"id": "101"," name ":" letter of guarantee "}, {" id ":" confirmation of conditions of carriage of goods "}, {" id ":" 102a "," name ":" guarantee "}, {" id "), and {" guarantee "}, {" id " {"id": "105"," name ":" dangerous goods / embargos}]}
},
{
lastKnowsAnswers: {avella / parcel 2mm / 2mm / 3mm,
pGoodsAdvice: / result: / 101s / 101s / s,
result: "[{" id ":" 101l "," name ":" Identification of conditions of Carriage of goods "}, {" id ":" 102s "," name ": "name": "out of the box"}, {"id": "105"," name ":" dangerous goods / embargoes "}]"}
}
]
I will now use rows: [{

"id" : "106",
"type" : "1476096570708556",
"name" : "",
"status" : "0",
"num" : 1,
"ename" : "Need not cer."

}, {

"id" : "101",
"type" : "1476096570708556",
"name" : "",
"remarks" : "",
"isLeaf" : "1",
"status" : "0",
"num" : 2,
"ename" : "Need cer."

}, {

"id" : "102",
"type" : "1476096570708556",
"name" : "",
"remarks" : "",
"isLeaf" : "1",
"status" : "0",
"num" : 3,
"ename" : "guarantee"

}, {

"id" : "104",
"type" : "1476096570708556",
"name" : "",
"remarks" : "",
"isLeaf" : "1",
"status" : "0",
"num" : 4,
"ename" : "Package-open"

}, {

"id" : "105",
"type" : "1476096570708556",
"name" : "/",
"remarks" : "",
"isLeaf" : "1",
"status" : "0",
"num" : 5,
"ename" : "DGR/Forbidden"

}}]
this data in rows replaces the values in each column of result in list in batches and needs to be judged by id, that is, only when the id in list is the same as the id in rows

Jun.27,2021

didn't make much judgment, so I need to change it myself.
basically seems to convert the array into key-value pairs and then reference them in the array. Of course, the id in rows cannot be repeated. This is an assumption.


let list = [

    {
        lastKnowsAnswers:{a:'1',b:'2',c:'3'},
        pGoodsAdvice:{
            a:'1',
            b:'2',
            c:'3', 
            result:'[{"id":"151","name":""},{"id":"101","name":""}, {"id":"102","name":""},{"id":"104","name":""},{"id":"105","name":"/"}]'
        }
    },
    {
        lastKnowsAnswers:{a:'1',b:'2',c:'3'},
        pGoodsAdvice:{
            a:'1',
            b:'2',
            c:'3', 
            result:'[{"id":"101","name":""},{"id":"102","name":""},{"id":"104","name":""},{"id":"105","name":"/"}]'
        }
    }
]

let arr =  [ {
    "id" : "106",
    "type" : "1476096570708556",
    "name" : "",
    "status" : "0",
    "num" : 1,
    "ename" : "Need not cer."
    }, {

    "id" : "101",
    "type" : "1476096570708556",
    "name" : "",
    "remarks" : "",
    "isLeaf" : "1",
    "status" : "0",
    "num" : 2,
    "ename" : "Need cer."
    }, {

    "id" : "102",
    "type" : "1476096570708556",
    "name" : "",
    "remarks" : "",
    "isLeaf" : "1",
    "status" : "0",
    "num" : 3,
    "ename" : "guarantee"
    }, {

    "id" : "104",
    "type" : "1476096570708556",
    "name" : "",
    "remarks" : "",
    "isLeaf" : "1",
    "status" : "0",
    "num" : 4,
    "ename" : "Package-open"
    }, {

    "id" : "105",
    "type" : "1476096570708556",
    "name" : "/",
    "remarks" : "",
    "isLeaf" : "1",
    "status" : "0",
    "num" : 5,
    "ename" : "DGR/Forbidden"
    } ]

 function replaceData (list,arr){
   //resultjson
    list.map((x,i)=>{
        x.pGoodsAdvice.result = JSON.parse(x.pGoodsAdvice.result)
    })
    list.map((x,i)=>{
        x.pGoodsAdvice.result.map((t,i)=>{
            arr.map((s)=>{
                if(t.id == s.id){
                    x.pGoodsAdvice.result[i] = s
                }
            })
            
        })
    })
    return list
}

 console.log('list',replaceData(list, arr))
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eace26-210c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eace26-210c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?