我有一个列类型为JSON的MySQL表
{
"type": "1",
"local": "1",
"maker": "1"
}我想要追加JSON数组
[{
"type": "1",
"local": "1",
"maker": "1"
},
{
"type": "2",
"local": "2",
"maker": "2"
}]我如何使用Strongloop来追加它?我使用了方法PUT/ID,它将我的数组替换为
{
"type": "2",
"local": "2",
"maker": "2"
}我不想获取/ID我的数组,然后合并new和send de PUT。
有可能结束吗?
发布于 2017-05-18 21:24:52
既然您已经选择了JavaScript作为标记,那么您就可以使用Array.prototype.concat()在JavaScript中执行此操作
有关更多详细信息,请参阅文档。
var x = {
"type": "1",
"local": "1",
"maker": "1"
};
var y = {
"type": "2",
"local": "2",
"maker": "2"
}
var result = [].concat(x).concat(y);
console.log(result);
https://stackoverflow.com/questions/44048929
复制相似问题