3

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?

3
  • 2
    have to tried to validate the json string? jsonlint.com Commented Jun 23, 2011 at 17:31
  • Thanks , yes there is an issue and i am tring to figure out "contactPhoto": "SIkADAjz94lQTkcNCho -----------------------^ Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[' Commented Jun 23, 2011 at 17:50
  • 1
    Well, jsonlint.com tells you where and what the error is. You should fix it. As we have no access to the whole data, we cannot help you more. Commented Jun 23, 2011 at 18:39

4 Answers 4

4

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

Sign up to request clarification or add additional context in comments.

2 Comments

I tried validating the json .This is the error message "contactPhoto": "SIkADAjz94lQTkcNCho -----------------------^ Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[' ..any help ? i am not able to get it
so are you missing a closing quote then?
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.

Comments

0

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

1 Comment

Java? you mean javascript?
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.