I\'m trying to parse a JSON string like this one ( generated URL with http://www.json-generator.com)
{
\"total\": 86,
\"jsonrpc\": \"2.0\",
\"id\": 1,
\
I am also face the same problem. I found that, issue was every if condition I am getting the jsonReader.nextName(). It is not correct way. I think your also doing the same way.
From your code these two lines create the problem.
// here the jsonReader moving one step.
Log.d("nextName", jsonReader.nextName());
//again your trying to getting the "jsonReader.nextName()" it is wrong in the above line already you got the name and reader move to next line. So Exception may be comes here.
String name = jsonReader.nextName();
we should use "jsonReader.nextName()" one time only for each iteration in while loop like
while (reader.hasNext())
{
String name=reader.nextName();
if(name.equals(Constants.AUTH)){
authDetails.setAuth(reader.nextString());
}else if(name.equals(Constants.STATUS)){
authDetails.setStatus(reader.nextInt());
}else if(name.equals(Constants.MESSAGE)){
authDetails.setMessage(reader.nextString());
}else {
reader.skipValue();
}
}