1

I have data in a table that looks something like this:

Col1, DataColumn
0   , 1
16  , 42
0   , 9

The most obvious JSON representation seems to be a list of associative arrays, but the JSON text would have Col1 and DataColumn repeated in it a lot.

Is there a JSON-standard way to store this without repeating the headers? My thought so far is to store it all as a list of lists and just know that the first row is names and the rest is data.

4

2 回答 2

2

使用数组来保存信息

{ 
    "headers" : ["one","two","three"],
    "rows" : [
        [1,2,3],
        [4,5,6],
        [7,8,9]
    ]
}
于 2012-05-16T04:08:51.947 回答
0

如果你想要紧凑的怎么办:

{"Col1": [0, 16, 0], "DataColumn": [1, 42, 9]}
于 2012-05-16T04:08:15.527 回答