表格数据导出JSON
eg:表格数据
A 12
B 20
B 32
A 28
B 23
导出JSON:
({"test ":[
{"class":"A","val":[{"value":"12","value":"28"}]},
{"class":"B","val":[{"value":"20","value":"32","value":"23"}]}
]})
求导出JSON的代码
------解决方案--------------------格式貌似不太标准呀 {"value":"12","value":"28"} 明显应该是个数组呀
------解决方案--------------------{"value":"12","value":"28"} 同一组能出现两个一样的属性吗??
------解决方案--------------------({"test ":[
{"class":"A","val":[{"value":"12"},{"value":"28"}]},
{"class":"B","val":[{"value":"20"},{"value":"32"},{"value":"23"}]}
]})
这种格式还差不多
------解决方案--------------------[{'col1': 'A', 'col2': '11'},{'col1': 'B', 'col2': '12'},{'col1': 'C', 'col2': '13'}]
------解决方案--------------------因为你描述错误。
{"class":"A","val":[{"value":"12"},{"value":"28"}]},
http://underscorejs.org/#groupBy