I get the following response generated by cakephp server
[ { "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" } }, ....... ]
The fact is that the parser expects an Event object, but if it is null , then it receives an empty array.
Since the response is auto- cakephp using cakephp , it needs to be modified in many places on the server side.
Is there a simple way for a jackson to ignore the Event property if its array is empty?
EDIT:
I tried to have two properties called Event : one array and another object, but that didn't work either.
vKashyap
source share