I need to use a huge JSON with 8000 elements (classes/subclasses) in it. I need to get it as a straight array (1-8000) in same sequence. Can i do with out creating classes?
Dictionary object doesn't give me orderly items.
{
"Root":{
"A":{
"Q1":"1",
"Q2":"2",
"Q3":"3"
},
"B":{
"Q1":"4",
"Q2":"5",
"Q3":"6"
},
"X":{
"Y1":"11",
"Y2":"22"
}
},
"SUB":{
"A":{
"Q1":"10",
"Q2":"20",
"Q3":"30"开发者_JAVA百科
},
"X":{
"Y1":"110",
"Y2":"220"
}
}
}
Convert something like below array
A-Q1,1
A-Q2,2
A-Q3,3
B-Q1,4
B-Q2,5
B-Q3,6
X-Y1,11
X-Y2,22
SUB-A-Q1,10
SUB-A-Q2,20
SUB-A-Q3,30
SUB-X-Y1,110
SUB-X-Y2,220
Since, in JSON:
An object is an unordered set of name/value pairs
Your options are:
- Change the source so it provides an array of objects instead of a set of key/value pairs
- Write a custom parser that doesn't treat it as JSON, but parses it into a data structure that you prefer
精彩评论