Exception in json parsing org. json. JSONException: A JSONObject text must begin with & #39 ;{& #39; at character 1? {Solution
The reason for this exception is that the json string format is not normal and does not end with "{" or "}". Check the json file format carefully to solve this problem. But sometimes the json file is normal, there is still this exception information, how to do it, this is because your json file header contains encoding characters (such as UTF-8 ), when reading a string, the json string is normal, but there is an exception in parsing. Generally, the json string is read from a server or a local file, and the file header contains the encoding, as far as I can see, Android2.1's mobile phone reports an exception. A phone number higher than 2.1 is normal.
Solution: Let's take a look at the differences between encoded files. Use UE to open json files with or without encoding, and switch to HEX mode, it is found that the encoded file contains three more bytes than the non-encoded file. when reading the encoded file, you only need to read the first three bytes so that the file can be parsed normally.
Files with UTF-8 Encoding:
Files without encoding: