我正在使用Rxandroid和翻新。我有這樣的動態變化的陣列名稱爲自動每個陣列變化的JSON,如何使用動態密鑰爲數組名稱創建Pojo類
{
"2016-10-02": [
{
"name": "foo",
"id": "1",
"category": "bar"
},
{
"name": "foo",
"id": "2",
"category": "bar"
},
{
"name": "foo",
"id": "3",
"category": "bar"
},
{
"name": "foo",
"id": "4",
"category": "bar"
}
],
"2016-10-01": [
{
"name": "foo",
"id": "5",
"category": "bar"
},
{
"name": "foo",
"id": "6",
"category": "bar"
},
],
"2016-10-03": [
{
"name": "foo",
"id": "5",
"category": "bar"
}
]
}
日期鍵名和的陣列變化的數量。在這個例子中有3個帶日期鍵的數組。但是這些數組的數量各不相同。
我已經通過各種鏈接在stackoverflow但無法解決問題。
你可以走兩條路。實現你自己的反序列化器,或者告訴Retrofit你想讓JsonObject(GSON庫)作爲響應,並從該對象中獲取內部數組。 – toshkinl
檢查[這個答案](http://stackoverflow.com/questions/7304002/how-to-parse-a-dynamic-json-key-in-a-nested-json-result) –
@Suresh Basnet:檢查下面回答完整的解析你的JSON響應 – Jai