开发者

Unable to parse JSON, uncaught syntax error?

I am trying to parse the following JSON:

06-22 18:49:17.182: ERROR/HTMLContacts(2716): Json:
[{"contactId":"1","contactPhoto":"SIkADAjz94lQTkcNChoKAAAADUlIRFIAAABgAAAAYAgCAAAAbfrgbwAAAANzQklUBQYFMwuNgAAA\nHuhJREFUeJztfU2LJLuS5ZlGAcfAEyTIggy4D14uZjGznB87q9nO75nFwMyiG+rBuxAJN0GCdLAD\nocUsTHL3yMisj3v开发者_如何学运维vm6abFkVVVoRcLpns85hJ+Z/+53//Hw4g4djUoS50oEsdANwF+PnLmaQ60IEE... }

It is a huge string array with an array length of almost 10,000.

I get the following error message:

Uncaught SyntaxError: Unexpected token ILLEGAL -- From line 1 of file:///android_asset/www/index.html

Could someone explain what is happening?


I can't make any sense of that at all. Have you tried validating your JSON first though? http://jsonlint.com/


I had the same problem with my phoneGap app running on MC40 android 2.3 and all I had to do is replace JSON.parse with $.parseJSON .Apparently JSON.parse has compatibility issues with older browsers.


Unescaped character that JavaScript isn't liking. Make sure it can take any character you receive.


Make sure there are no tabs in there by replacing them with \t.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜