我的目标是得到一个像这样的 json 数组:
var args = [{ name: 'test', value: 1 }, { key: 'test2', value: 2}];
我怎样才能得到下面的代码来构建像上面一样的数组?
this.dependentProperties = []; //array
function addDependentProperty(depName, depValue) {
dependentProperties.push(new Array(depName, depValue));
}
通过使用 Push 方法,我最终得到了如下所示的 json 表示法:
args:{[["test1",1],["test2",2]]}
dependentProperties.push({name: depName, value: depValue});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)