我有一个 Json 波纹管:
{
"0001":[111, "BLABLA", "LALA", "KKK",80,20],
"002":[222, "BLABLA", "LALA", "KKK",80,40],
"003":[333, "BLABLA", "LALA", "KKK",100,20],
"000":[444, "BLABLA", "LALA", "KKK",800,60],
"555":[555, "BLABLA", "LALA", "KKK",80,20,
"100":[48, "BLABLA", "LALA", "KKK",80,20]
}
我在使用 Gson 反序列化时遇到问题。我知道使用 Json 的变量名定义如下:
{
"item":"001":["id":1,"description":"bla bla"],
"item":"002":["id":2,"description":"bla bla"]
}
然后我用json的相同变量名定义了类并执行了解析
public class DataClass
{
String item;
int id;
String description;
getters and setters;
}
gson.fromJson (json, DataClass.class);
但是如果我需要使用没有变量名的json(在帖子的开头),我不知道该怎么做。任何人都可以帮忙吗?