Json フォーマットの後、次のような結果が得られました。
MyObject
public class MyObject {
public List<List<Part>> Answers;
public List<List<Part>> getAnswers() {
return Answers;
}
}
部
public class Part {
private String Locale;
private String Name;
public String getLocale() {
return Locale;
}
public String getName() {
return Name;
}
}
主要
public static void main(String[] args) {
String str = " {" +
" \"Answers\": [[{" +
" \"Locale\": \"Ru\"," +
" \"Name\": \"Name1\"" +
" }," +
" {" +
" \"Locale\": \"En\"," +
" \"Name\": \"Name2\"" +
" }]," +
" [{" +
" \"Locale\": \"Ru\"," +
" \"Name\": \"Name3\"" +
" }," +
" {" +
" \"Locale\": \"En\"," +
" \"Name\": \"Name4\"" +
" }]]" +
" }";
Gson gson = new Gson();
MyObject obj = gson.fromJson(str, MyObject.class);
List<List<Part>> answers = obj.getAnswers();
for(List<Part> parts : answers){
for(Part part : parts){
System.out.println("locale: " + part.getLocale() + "; name: " + part.getName());
}
}
}
出力:
locale: Ru; name: Name1
locale: En; name: Name2
locale: Ru; name: Name3
locale: En; name: Name4