Gson解析json,没有key,不确定key,javabean
2017-12-27 本文已影响0人
e1f48f6c2de0
1.没有key
json:
{
"person":[
{
"name" : "hello",
"childs" : ["few", "gr3"]
},
{
"name" : "world",
"childs" : ["h4w", "ku6r"]
}
]
}
jsonBean:
public class JsonBean {
public ArrayList<Person> person;
public static class Person{
String name;
ArrayList<String> childs;
}
}
2.不确定key
json:
{
"person":[
{
"name" : "hello",
"childs" : [{"1":"few"}, {"2":"akuy"}]
},
{
"name" : "world",
"childs" : [{"8":"ngf"}, {"9":"y54"}]
}
]
}
jsonbean:
public class JsonBean {
public ArrayList<Person> person;
public static class Person{
String name;
ArrayList<Map<String,String>> childs;
}
}