[{ID: 1, name: "Home", parent_ID:"0"},
{ID: 2, name: "Wisdom", parent_ID:"0"},
]
db.query ( SELECT * FROM column_table WHERE parent_ID=0
, (err,data) = > {
if(err){
console.log("err1: "+err)
res.status(500).send("database err").end();
}else{
data = JSON.parse(JSON.stringify(data))
for(var i=0;i<data.length;iPP){
db.query(`SELECT * FROM column_table WHERE parent_ID=2`,(err,child_data)=>{
if(err){
console.log("err2: "+err);
res.status(500).send("database err").end();
}else if(child_data.length==0){
data[i].child_column=[];
}else{
data[i].child_column=child_data;
}
})
}
res.render("admin/index.html",{column_data:data})
}
})
this is the result of the console.log (data) output after my query. I want to add an attribute to each object in the array. Direct data [I] .child _ column="222", is wrong. How should I add it