问题
JSON file:
JSON FILE URL
i am looping through the "biller" Array to fetch all the object's where "billerCategory": is "Electricity". I am trying to get "paramName" value. But i am only getting 3 paramName values.
Response:
Code:
try {
JSONArray biller = response.getJSONArray("biller");
Log.d(TAG, biller.toString());
// Loop through biller Array and find billerID
for (int i = 0; i < biller.length(); i++)
{
JSONObject billerObj = (JSONObject) biller.get(i);
String category = billerObj.getString("billerCategory");
//Log.d(TAG, category);
if (category.equalsIgnoreCase("Electricity")){
JSONObject paraminput = billerObj.getJSONObject("billerInputParams");
JSONObject paramInfo = paraminput.getJSONObject("paramInfo");
String paramName = paramInfo.getString("paramName");
Log.d(TAG, paramName);
}
}
}
回答1:
An exception has occured. Search for 'TORR00000SUR04'. It happened that "paramInfo" is an JSONArray at that point.
来源:https://stackoverflow.com/questions/60574258/unable-to-parse-json-object-using-volley