Need to convert Json
{"1":{"param1":"101","param2":"pamagiti"},"2":{"param1":"102","param2":"pozar0"}} AT
Map<String, JSONArray> Thus, for the key to be 1.2, the value {"param1": "101", "param2": "pamagiti"} and {"param1": "102", "param2": "pozar0"} respectively (in the form of JSONArray )
To do this, try this code
Type type = new TypeToken<HashMap<String, JSONArray>>(){}.getType(); Map<String, JSONArray> myMap = new Gson().fromJson(JsonString, type); for (Map.Entry<String, JSONArray> param : myMap.entrySet()) { Log.d("com.test.application", "ID " + param.getKey() + " " + param.getValue().toString() ); } But JSONArray is empty
ID = 1 [] ID = 2 []