var a = ‘{"name":"1234"}‘;
var c = ‘{["name":"张三","age":18],["name":"李四","age":19]}‘;
var f = JSON.parse(a);//这样写正确
var t = JSON.parse(c);//json数组的时候提示语法错误
最佳答案:
你那个数组是有问题的,要var c = ‘[{"name":"张三","age":18},{"name":"李四","age":19}]‘; 这样定义
时间: 2024-11-18 08:48:57