Advise how GSON in an array. Link to GSON: http://cache-minsk03.cdn.yandex.net/download.cdn.yandex.net/mobilization-2016/artists.json
- If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky ♦
|
1 answer
You need to create a class that describes your object model. Add dependencies to gradle gson.
compile "com.google.code.gson:gson:2.+" Then get your json'a string, and then:
Gson gson = new GsonBuilder().create(); OurModel[] arrayOfOurModels = gson.fromJson(jsonString, OurModel[].class); where OurModel is a model that describes your entity in json
public class OurModel { private int id; private String name; private int tracks; private int albums; private String link; private String description; private CoverEntity cover; private List<String> genres; public static class CoverEntity { private String small; private String big; } } - What does it mean to get your line json "a? And how did you create Ourmodel? As long as it’s not clear what book can be? - vlad_22de
- When you click on the link that you gave in the description, the Html page opens with the text, this is your json'a line - Yury Pashkov
- I created OurModel according to your josn object, copy all your json and paste json.parser.online.fr here and see your structure - Yury Pashkov
- I can still copy the last question from here cache-minsk03.cdn.yandex.net/download.cdn.yandex.net/… insert it here json.parser.online.fr - vlad_22de
- And what is your question? - Yury Pashkov
|
