Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

org.json.JSONException: Unterminated string at 737 [character 738 line 1]

Tags:

java

json

iphone

I'm using the org.json.JSONObject to parse some json being sent to my servlet by an iphone. I was stuck for a while by why I would be getting an error message at all. The error message was:

org.json.JSONException: Unterminated string at 737 [character 738 line 1]

After printing out what I received, I see that the string sent was indeed cut short and stopped mid-json. I can't understand why it would be cut short. There's no limit on String size is there (or at least only a memory limit surely).

Has anyone else had thins error?

Cheers

Joe

like image 721
Joe Avatar asked Jan 31 '11 17:01

Joe


1 Answers

json work well with \n but if you have any other special charachters in your meesage like \ , @ , & , # etc.. first convert them into their respective HEX value and then send your message.

like image 139
maria farooq Avatar answered Nov 12 '22 12:11

maria farooq