Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8677467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:27:51+00:00 2026-06-12T20:27:51+00:00

I am getting following response generated from the server by cakephp [ { id:

  • 0

I am getting following response generated from the server by 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"
  }
 },
 .......
 ]

The thing is that the parser expects Event object but if its null then it is receiving empty array.

Since the response is auto generated by cakephp, it has to be changed at a lot of places on server side.

Is there any simple way for jackson to ignore Event property if its an empty array??

EDIT:

I have tried having two properties with Event name: one array and other object but that too didn’t work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T20:27:53+00:00Added an answer on June 12, 2026 at 8:27 pm

    Since, I had to handle response like this for many objects I finally went ahead with creating a generic class which would return a Deserializer for a specific class.

    Here is what I used

    public class Deserializer<T> {
    
      public JsonDeserializer<T> getDeserializer(final Class<T> cls) {
          return new JsonDeserializer<T> (){
    
             @Override
             public T deserialize(JsonParser jp, DeserializationContext arg1) throws IOException, JsonProcessingException {
                JsonNode node = jp.readValueAsTree();
                if (node.isObject()) {
                  return new ObjectMapper().convertValue(node, cls);
                }
                return null;
             }
         };
    }
    

    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting a following response from the back-end servers to display the data as
I'm getting the following json response for one of my android service server response,im
(Following up on this question: Getting raw XML response from Java web service client
I am new to WebService. I am getting the following response from the WebService
Through an API, I am getting following JSON response, status: 550, created: 2012-07-02 19:00:58,
i am getting following error while getting data from dictionary -[__NSCFString objectForKey:]: unrecognized selector
I run a print_r command on $_POST and I am getting the following response:
I am getting following encoded html as a json response and has no idea
Am getting following error message on calling WCF service: The formatter threw an exception
I am Getting following error on exporting the video using [exportSession exportAsynchronouslyWithCompletionHandler:^ Error: -[TiBlob

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.