bigbone
bigbone
2008-12-27 23:08

如何动态生成json数组?

  • javascript

如题:
[code="java"]var oArray_1 = {
"menu1":[
{
"id":"create_new",
"text":"test",
"index":1,
"baseClass":"characterMenuItem",
"iconClass":"characterMenuItem_Icon",
"textClass":"characterMenu_Text",
"hasChildMenu": true,
"itemStep":0,
"separator":true,
"clickHandle":function(){
}
},
{
"id":"create_new_file",
"text":"test",
"baseClass":"characterMenuItem1",
"iconClass":"characterMenuItem_Icon",
"textClass":"characterMenu_Text",
"index":2,
"value":"test",

"hasChildMenu": false,
"itemStep":1,
"separator":true,
"clickHandle":function(){
createNewFile('x');

}
},
{
"id":"RO_doc",
"text":"test",
"baseClass":"characterMenuItem1",
"index":3,
"iconClass":"characterMenuItem_Icon",
"textClass":"characterMenu_Text",
"value":"RedOffice",

"hasChildMenu": false,
"itemStep":1,
"clickHandle":function(){

createNewFile('testRedOfficeeτؖ´¦m.odt','file');

}
},
{
"id":"RO_table",
"text":"RedOffice",
"baseClass":"characterMenuItem1",
"index":4,
"iconClass":"characterMenuItem_Icon",
"textClass":"characterMenu_Text",
"value":"RedOffice",

"hasChildMenu": false,
"itemStep":1,
"clickHandle":function(){
createNewFile('testRedOfficee.ods','file');

}
},
{
"id":"RO_PP",
"text":"test",
"baseClass":"characterMenuItem1",
"index":5,
"iconClass":"characterMenuItem_Icon",
"textClass":"characterMenu_Text",
"value":"sss",

"hasChildMenu": false,
"itemStep":1,
"separator":true,
"clickHandle":function(){
createNewFile('testRedOfficeeҝʾτ¸㭯dp','file');

}
}
]
}[/code]
通过js生成如下结构的json数组?

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐

换一换