Try with JSON
.
String str="["ddd.jpg","Wallpaper.jpg","ddd.jpg"]";
Type collectionType = new TypeToken<String[]>() {
}.getType();
String[] a=new Gson().fromJson(str,collectionType);
for (String i:a){
System.out.println(i);
}
Output
ddd.jpg
Wallpaper.jpg
ddd.jpg
Edit: for your edited question answer like this.
public class Obj{
private String name;
private List<String> appIcons;
public List<String> getAppIcons() {
return appIcons;
}
public void setAppIcons(List<String> appIcons) {
this.appIcons = appIcons;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Now you can simply pass your JSON
String str = "{"name":"Saaa","appIcons":
["ddd.jpg","Wallpaper.jpg","ddd.jpg"]}";
Obj obj = new Gson().fromJson(str, Obj.class);
System.out.println(obj.getAppIcons());
Output:
[ddd.jpg, Wallpaper.jpg, ddd.jpg]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…