Unexpected number (index) error with JSON string such as
var jsonstr = "{1: ' Beijing note Notes ', 2: ' Shanghai note Notes ', 3: ' Guangdong Note Information ', 4: ' Shenzhen note ' Note 4 ', 5: ' Tianjin note ' Note 5 ', 6: ' Hubei Note 6 ', 7: ' Chongqing note 7 ', 8: ' EU note note 8 ', 9: ' California State note Information 8 ', 10: ' Quebec, Canada Note ', 11: ' Rggi Association of Northeastern United States ', 12: ' Australia notes ', 13: ' New Zealand Notes ', 14: ' Tokyo notes 11111 ', 15: ' Korean Seoul information ', 16: ' Swiss information notes '};
With open source China and other JSON format this string can parse the normal, can jquery parse when the error does not recognize you this set, had to find the wrong.
Uncaught syntaxerror:unexpected token ' error string such as:
var jsonstr = "{' Beijing ': 1, ' Shanghai ': 2, ' Guangdong ': 3, ' Shenzhen ': 4, ' Tianjin ': 5, ' Hubei ': 6, ' Chongqing ': 7, ' EU ': 8, ' California State ': 9, ' Canada Quebec ': 10, ' American Rggi ' : 11, ' Australia ': 12, ' New Zealand ': 13, ' Tokyo ': 14, ' Korea ': 15, ' Switzerland ': 16} "
The same is true with the JSON format tool, which has to look at the jquery document for Jquery.parsejson () usage. The following examples are given:
Parse a JSON string
JQuery Code:
var obj = jQuery.parseJSON(‘{"name":"John"}‘);alert( obj.name === "John" ); 我想难道就是里面 单引号和双引号的问题吗,现在无其他解决方法,只好按着实例换,结果还真解析成功。估计jquery源码没做对字符串里面的符号做处理,来判断里面包含什么样的单引号。
The solution to the general problem is found, it is easy to start.
For JSON strings are pieced together from the background, because the areaid as a key part, the result is directly jsonstr.append (' "' +etsmapinfo.getaeid () + '"); It's old man turned 1 into 69 I don't understand. But I was a ruthless recruit, in the outside first to turn into a string. Alas
It's all about solving problems first.
JSON format string problems with Jquery.parsejson () uncaught syntaxerror:unexpected token ' uncaught syntaxerror:unexpected number ( Index