JSON parsing error of Map objects in Android API version <= 18
Camerash opened this issue · comments
Esmond Wong commented
Problems
LoginRequest
and SignupRequest
contains Map
Object, which is then stored in another Map
object. This causes parse error in Android API version under 18 (Jellybean or below)
The error is shown with volley throwing 400 bad request
and is visible in logcat
Example
LoginRequest
JSONObject:
- Android KitKat or above:
{"action":"auth:login","auth_data":{"email"="esmond9981127@gmail.com", "username=esmond-testing"}......
- Android Jellybean(4.3.1) or below:
{"action":"auth:login","auth_data":"{email=esmond9981127@gmail.com, username=esmond-testing}"......
As the example have shown, Android KitKat or above can parse the Map
object successfully, while Jellybean or below only treated the Map
object as String
, which caused the 400 error as the request is malformed.
Consider reading the comment session of: https://stackoverflow.com/a/12155874
How to recreate
Try signing up / login with any Android device running Jellybean or below
Esmond Wong commented