I am building an Android application and I have JSON data which contains Unicode strings. When receiving the data and using InputStreamReader to parse it, the Unicode strings stay fine. However, when I use JsonReader to parse the JSON, it appears to have converted it into some format. I have looked at the source code and it doesn't seem like it does anything out of the ordinary (obviously I might be missing something) - it just takes the string and saves it into a String variable. Does anyone have any ideas on why my Unicode strings are being converted incorrectly?
Thanks
You can decode your stream to string using InputStreamReader and specify your encoding (e.g. UTF-8 or Unicode), then pass your string to JSONObject or JSONArray to create such object.
JsonReader reader = new JsonReader(new InputStreamReader(in, "UTF-8"));
Reference documents:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With