JQ 操作JSON 新增元素
前端
依赖JQ, 只供参考:
function getNewJson(json) {
if(json.length > 0){
var newJson = [{}]; //定义JSON数组
$.each(json, function (index, obj) {
newJson[index] = obj; //新增对象
});
return newJson;
}
return null;
}
编辑:一起学习网