Preethi
Preethi

Reputation: 2152

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\nocUsTHL3yMisj3vvm6abFkVVVoRcLpns85hJ+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?

Upvotes: 3

Views: 14802

Answers (4)

user2547151
user2547151

Reputation: 1

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.

Upvotes: 1

NotAMeme
NotAMeme

Reputation: 1

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

Upvotes: 0

TravMan
TravMan

Reputation: 342

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

Upvotes: 0

thescientist
thescientist

Reputation: 2948

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

Upvotes: 4

Related Questions