2

嗨,我有这段代码来解析 JQUERY 上的 JSON

var json_text2 = $.parseJSON('{"data":[["1340650436","2.00000"],["1340736844","4.00000"]],"label":"Waist Size (cm)"},{"data":[["1340736861","3.40000"],["1340650514","4.00000"]],"label":"Arm Size (Inch)","yaxis":"2"}');

但是我在 Firebug 上遇到了这个错误

JSON.parse: unexpected non-whitespace character after JSON data
4

1 回答 1

5

有效的 JSON 字符串必须是单个对象或对象数组。将您的对象包装在数组括号中[]

var json_text2 = $.parseJSON('[{"data":[["1340650436","2.00000"],["1340736844","4.00000"]],"label":"Waist Size (cm)"},{"data":[["1340736861","3.40000"],["1340650514","4.00000"]],"label":"Arm Size (Inch)","yaxis":"2"}]');
于 2012-06-27T14:50:00.043 回答