Java Gson无法分析嵌套的字符串对象
如何解析嵌套对象Java Gson无法分析嵌套的字符串对象,java,android,arrays,json,gson,Java,Android,Arrays,Json,Gson,如何解析嵌套对象 [{ "id": 100500, "products": "[{\"id\":45,\"title\":\"All Product\"]" }] 模范班 public class Store { public long id; public List<Product> products; } 公共类存储{ 公共长id; 公开上市产品; } 不,它将解析 public class Store {
[{
"id": 100500,
"products": "[{\"id\":45,\"title\":\"All Product\"]"
}]
模范班
public class Store {
public long id;
public List<Product> products;
}
公共类存储{
公共长id;
公开上市产品;
}
不,它将解析
public class Store {
public long id;
public List<Product> products;
}
Gson mGson= new Gson();
storeList=mGson.fromJson(json, Store.class);
storeList.getStores().get(0).getProducts().get(1);
公共类存储{
公共长id;
公开上市产品;
}
Gson mGson=新的Gson();
storeList=mGson.fromJson(json,Store.class);
storeList.getStores().get(0.getProducts().get(1);
不,它将解析
public class Store {
public long id;
public List<Product> products;
}
Gson mGson= new Gson();
storeList=mGson.fromJson(json, Store.class);
storeList.getStores().get(0).getProducts().get(1);
公共类存储{
公共长id;
公开上市产品;
}
Gson mGson=新的Gson();
storeList=mGson.fromJson(json,Store.class);
storeList.getStores().get(0.getProducts().get(1);
Hi将您的Gson更改为
{
"Id": "100500",
"products": [
{
"id": 1,
"title": "title 1"
},
{
"id": 2,
"title": "title 2"
},
{
"id": 3,
"title": "title 3"
}
]
}
嗨,把你的Gson换成
{
"Id": "100500",
"products": [
{
"id": 1,
"title": "title 1"
},
{
"id": 2,
"title": "title 2"
},
{
"id": 3,
"title": "title 3"
}
]
}
我用替换字符串解算我用替换字符串解算