1
在Rails中,如何访问此json的各个元素?我用ruby的.to_json方法解析它。 json = CSV.parse(csv).to_json
。 这里返回什么:使用方括号访问Json
[
[
"id",
"subject"
],
[
"1",
"Economics"
],
[
"2",
"General Paper"
],
[
"3",
"History"
],
[
"4",
"Geography"
],
[
"5",
"Mathematics"
],
[
"6",
"Chemistry"
],
[
"7",
"Biology"
],
[
"8",
"Physics"
]
]
尝试访问json[0][1]
或json[0]
回报"["
我有一种感觉它与方括号做的,但我敢肯定有办法来访问它(它看起来像阵列中的数组,我的访问方式应该工作)