code is:
String userInfoStr = new Gson().fromJson("{\"name\":\"admin\"}", String.class);
This is not a bug in the library. Your JSON contains an object but you asked it to deserialize as a string. There are many questions on StackOverflow which explain this error. I would also recommend going through the Gson documentation about binding to objects which talks about how you create objects which represent JSON.
Most helpful comment
This is not a bug in the library. Your JSON contains an object but you asked it to deserialize as a string. There are many questions on StackOverflow which explain this error. I would also recommend going through the Gson documentation about binding to objects which talks about how you create objects which represent JSON.