There is an ArrayList<Integer> array = new ArrayList<Integer>() ,
I translate it into Json with the command: new Gson().toJson(array)
How to parse Json back into an array?
There is an ArrayList<Integer> array = new ArrayList<Integer>() ,
I translate it into Json with the command: new Gson().toJson(array)
How to parse Json back into an array?
Type listType = new TypeToken<List<Integer>>() {}.getType(); List<Integer> result = new Gson().fromJson(json, listType); ArrayList<String> listdata = new ArrayList<String>(); JSONArray jArray = (JSONArray)jsonObject; if (jArray != null) { for (int i=0;i<jArray.length();i++){ listdata.add(jArray.get(i).toString()); } } Source: https://ru.stackoverflow.com/questions/573931/
All Articles
Gson.fromJSON(...)logically ... tried? - Vladyslav Matviienko