我后台node通过mysql查询出来的数据格式是这样,如下图
我实际需要的数据格式是
var resObject=[
{
"idValue":"dh1",
"resTitle":"UI框架",
"linkArray":[
{
"linkAddress":"http://getbootstrap.com/",
"linkName":"Bootstrap"
},
{
"linkAd dress":"http://foundation.zurb.com/",
"linkName":"Foundation"
},
{
"linkAddress":"http://semantic-ui.com/",
"linkName":"Semantic-UI"
}
]
},
{
"idValue":"dh2",
"resTitle":"JS库",
"linkArray":[
{
"linkAddress":"http://jquery.com/",
"linkName":"jQuery"
},
{
"linkAddress":"https://angularjs.org/",
"linkName":"AngularJS"
},
{
"linkAddress":"https://facebook.github.io/react/",
"linkName":"React"
},
{
"linkAddress":"https://cn.vuejs.org/",
"linkName":"Vue"
}
]
}
];
需要怎么把查询出来的数据格式改成我需要的格式呢?