getオブジェクト "services"の場合と同じですか?あなたはJSONArray
を期待しているが、代わりにあなたがJSON object
を取得しているレトロフィットを言っているので、Retrofit:BEGIN_ARRAYは期待されましたが、BEGIN_OBJECTでした
{
"success": "true",
"code": "200",
"message": "The operation was successful",
"data": {
"hairdressers": [
{
"name": "Jason Grant",
"image_profile": "http:\/\/www.kbapi.co\/images\/header\/3.png",
"open": "09:00:00",
"close": "15:00:00",
"id": "2",
"id_saloon": "4",
"services": [
{
"name": "Corte",
"price": "8000",
"image": "http:\/\/www.kbapi.co\/images\/header\/1.png",
"time": "01:00:00",
"type": "W",
"saloon_id": "4",
"service_id": "3"
},
{
"name": "Corte",
"price": "8000",
"image": "http:\/\/www.kbapi.co\/images\/header\/1.png",
"time": "01:00:00",
"type": "C",
"saloon_id": "4",
"service_id": "4"
},
{
"name": "Corte",
"price": "9000",
"image": "http:\/\/www.kbapi.co\/images\/header\/1.png",
"time": "01:00:00",
"type": "O",
"saloon_id": "4",
"service_id": "5"
}
]
},
{
"name": "Herbert Davis",
"image_profile": "http:\/\/www.kbapi.co\/images\/header\/4.png",
"open": "10:00:00",
"close": "16:00:00",
"id": "3",
"id_saloon": "4",
"services": []
}
]
}
}
を使用することができますオブジェクトを生成するために、1つの以上のJavaクラスで
のオブジェクトのリストをラップする必要がありますが、美容師の場合。その場合、私はできますか? –
これは、サーバーの構築方法によって異なります。サーバーは、サービスが停止している状態コードを送信することがあります。その場合、応答は正しくデシリアライズされ、onResponse()の状態コードをチェックする必要があります。もう1つの可能性は、レスポンスが完全に空になり、デシリアライゼーションが失敗し、onFailure()がコールされ、そのコールを正常に処理する必要があるということです。 –
これは –