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
InputStreamReaderand specify your encoding (e.g. UTF-8 or Unicode), then pass your string toJSONObjectorJSONArrayto create such object.Reference documents: