[Solved] How to get values from JSON Array which doesn’t follow “key” : “value” standard / JSON with no Key?


It’s pretty much the compressed format of JSONArray, I’ve seen it few times, some systems use it to lower the amount of data that gets transferred.
You can try something like this (edit how you need it, as this is only a basic concept):

// Let us assume your JSON is loaded in jsonString variable
try { 
    JSONArray jsonArray = jsonString.getJSONArray("result");
    for (int i = 0; i < jsonArray.length(); i++) {
        JSONArray jsonSubArray = jsonArray.getJSONArray(i);
        for (int j = 0; j < jsonSubArray.length(); j++) {
            // Will read a String or cast the element to String
            // Also it might throw JSONException so you would probably want to handle that too
            Log.d("element", "[" + i + "|" + j + "] = " + jsonSubArray.getString(j));
        }
    }
} catch (JSONException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

0

solved How to get values from JSON Array which doesn’t follow “key” : “value” standard / JSON with no Key?