I am trying to parse {"type_history":[["15","0.07","apple"],["13","0.03","banana"],["10","0.23","lemon"]]},I try to get array in JsonArray but fail.
String myJson="{"type_history":[["15","0.07","apple"],["13","0.03","banana"],["10","0.23","lemon"]]}";
ArrayList<UserType> rtn = new ArrayList<>();
JSONArray j=myJson.optJSONArray("type_history");
for (int i = 0; i < j.length(); i++) {
UserType tmp = new UserType();
JSONArray tmpArray = new JSONArray(Arrays.asList(j.get(i)));
tmp.setType(tmpArray.getString(0));
tmp.setValue(Float.parseFloat(tmpArray.getString(1)));
rtn.add(tmp);
}
in tmpArray.getString(0), I still get ["15","0.07","apple"],not get "15"
how to fix my code for get value from this array?