/***************************
*如何循环8次,生成如下JSON结构
****************************/
var labels = ["R","A","B","C","D","E","F","G"];
var JSON_DATA = new Object();
var ARR_1 = new Array();
var ARR_2 = new Array();
//To do?
//...
JSON_DATA["x"] = ARR_1;
JSON_DATA["y"] = ARR_2;
/***************************
*希望生成后的JSON结构
****************************/
JSON_DATA = {
"x":[{
nIndex:0,
name:"R",
basic:{
R1:"",
R2:"",
R3:"",
R4:""
},{
nIndex:1,
name:"A",
basic:{
B1:"",
B2:"",
B3:"",
B4:""
}
},{
nIndex:2,
name:"B"
},{
nIndex:3,
name:"C"
},{
nIndex:4,
name:"D"
},{
nIndex:5,
name:"E"
},{
nIndex:6,
name:"F"
},{
nIndex:7,
name:"G"
}
],
"y":[{
source:0,
target:1
},{
source:0,
target:2
},{
source:0,
target:3
},{
source:0,
target:4
},{
source:0,
target:5
},{
source:0,
target:6
},{
source:0,
target:7
},
]
}
添加回答
举报
0/150
提交
取消