I'm having some trouble with I want going to get a JSON format array-object string,
and the array definite [{"code":"123","path":"456"},.....}]
but when working on
JArray.getJSONObject(0).getString("code")
it's display "null"
Has anyone could explain why it happens?
thanks for your solutions
for(int i=0;i<JArray.length();i++) {
try {
avr_hash = JArray.getJSONObject(i).getString("code");
img_adress[JArray.length()] = JArray.getJSONObject(i).getString("path");
}catch (JSONException e){
Log.e("Catch obj",e.toString());
}
}
IDE : Android Studio
solution : array index setting erroneous

iinstead ofexist_json_array_countinside your loop?