- JScript code
function house(id, name, code, color) { this.id = id; this.name= name; this.code= code; this.color=color; }function housetojson() { var house_01=new house("xx","xx", xx,"xx"); var json=house_01.toJSON(); } //上面是一个对象//然后我使用了json官网的的json文件来生成对象//上面的代码我懂//下面我要生成多个house对象,并在同一个json对象里保存所有的对象信息//也就是说动态添加json对象数据,这个我就不懂了。。。。。知道的麻烦说下,我分不多,谢谢了
------解决方案--------------------------------------------------------
var jsonary = [];
for(i = 0; i < 10; i ++) {
var house = new house("xx","xx", xx,"xx");
jsonary.push(house);
}