I'm a beginner in java/Android and I try to parse JSON with Gson.
I'm having some difficulty with the files part. From what I've read I should use MapHash but I'm not sure how to use it in this code
Here my Main class
InputStream source = retrieveStream(url);
Gson gson = new Gson();
Reader reader = new InputStreamReader(source);
SearchResponse response = gson.fromJson(reader, SearchResponse.class);
The class that do the parsing
public class SearchResponse {
public List<Podcast> podcasts;
class Podcast {
@SerializedName("files")
private List<File> files;
@SerializedName("format")
private String format;
@SerializedName("title")
private String title;
class File {
private String ValueX;
private String URLX;
}
}
}
json structure
{
"podcasts": [
{
"files": [
{"NameA": "ValueA"},
{"NameB": "ValueB"},
{"...": "..."}
],
"format": "STRING",
"title": "STRING"
}
]
}
Thanks for your help
here's an edited file of the structure of the JSon I try to parse http://jsontest.web44.net/noauth.json