Org.json.jsonexception:a Jsonobject text must begin with ' {' @ 1 [character 2 line 1]

Source: Internet
Author: User

Reference:

http://bbs.csdn.net/topics/390851535

Content:

One more character reason:
Open a Test.txt text file with a text editor (notepad++)

The first choice is the red box encoding, so that the length of the read string is always 28 (inexplicable one more characters), will report an exception, because the first character is not ' {'
The second choice is the blue box encoding, so that the length of the read out of the string is 27, and we think of the same length, will not report an exception

My Code processing:

1 asotest.handledowntotal (downtotalcollection,line.substring (1)); // line.substring (1), excluding the first character more out of the case, Jsonobject recognize the first character as ' {'

Org.json.jsonexception:a Jsonobject text must begin with ' {' @ 1 [character 2 line 1]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.