サーバーから生成された次の応答を取得していますcakephp
[
{
"id": "42389",
"start": "0000-00-00",
"end": "0000-00-00",
"event_id": null,
"trip_id": "5791",
"location_id": "231552",
"user_id": "105",
"users_attending": "0",
"user_local": "0",
"Trip": {
"name": "Asdas"
},
"Event": [],
"Location": {
"name": "South Melbourne"
}
},
{
"id": "42392",
"start": "0000-00-00",
"end": "0000-00-00",
"event_id": "1218",
"trip_id": "4772",
"location_id": "271505",
"user_id": "105",
"users_attending": "3",
"user_local": "50",
"Trip": {
"name": "trip by 1059200"
},
"Event": {
"title": "SampleEvent 454",
"id": "1218"
},
"Location": {
"name": "Houston"
}
},
.......
]
問題は、パーサーEvent
がオブジェクトを予期しているが、その場合null
は空の配列を受け取っているということです。
応答はによって自動生成されるためcakephp
、サーバー側の多くの場所で変更する必要があります。
Event
ジャクソンが空の配列の場合にプロパティを無視する簡単な方法はありますか?
編集:
1つの配列と他のオブジェクトという名前の2つのプロパティを試してみEvent
ましたが、それも機能しませんでした。