谁能帮我把下面的JSON转换成java对象(列表),而不需要java bean。我是JSON新手
我使用的是gson-2.2.4.jar我猜你的意思是没有为gson编写自己的bean进行反序列化。GSON提供支持,您可以使用某些JSON类型:谁能帮我把下面的JSON转换成java对象(列表),而不需要java bean。我是JSON新手,java,json,collections,Java,Json,Collections,我使用的是gson-2.2.4.jar我猜你的意思是没有为gson编写自己的bean进行反序列化。GSON提供支持,您可以使用某些JSON类型: [ { "id": "1234", "price": 1000, "categories": [ "Fashion/Shirt" ], "category_id": [ "1234564" ], "gender": "Male", "brand": "Wonde
[
{
"id": "1234",
"price": 1000,
"categories": [
"Fashion/Shirt"
],
"category_id": [
"1234564"
],
"gender": "Male",
"brand": "Wonder",
"fashion_composition": [
{
"material": "silk",
"percentage": 78
},
{
"material": "Cotton",
"percentage": 22
}
],
"fashion_season": {
"season": "continuity",
"year_season": 2014
},
"fashion_size": {
"size_type": "US",
"size_description_1": "size",
"size_1_manufacturer": "90",
"size_description_2": "top",
"size_2_manufacturer": "C",
"size_1": [
"90"
],
"size_2": [
"C"
]
}
},
{
"id": "5678",
"price": 1000,
"categories": [
"Fashion/Skirt"
],
"category_id": [
"1234564"
],
"gender": "Female",
"brand": "Wonder",
"fashion_composition": [
{
"material": "silk",
"percentage": 78
},
{
"material": "Cotton",
"percentage": 22
}
],
"fashion_season": {
"season": "continuity",
"year_season": 2014
},
"fashion_size": {
"size_type": "US",
"size_description_1": "size",
"size_1_manufacturer": "90",
"size_description_2": "top",
"size_2_manufacturer": "C",
"size_1": [
"90"
],
"size_2": [
"C"
]
}
}
]
查看此可能的副本
Gson gson = new Gson();
final JsonArray jsonElements = gson.fromJson(JSON, JsonArray.class);