0

In rest services how to dynamically avoid pojo class properties? That is, for example I have this POJO class

public ClassA{

private String a;
private String b;
private String c;

}

When I am returning my Json response from my main class, according to conditions, I want to ignore one value (but this ignore value is not always constant), it will differ. For example, sometime return combo is a,b and some other time b,c or a,c.

Currently it returns to me like below

"a" : "aa", "b": "bb", "c": null

But in the above set, I do not want to show "c" : null

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Yoga
  • 293
  • 3
  • 8
  • 23
  • You just want to ignore null values or based on some other condition? If some other condition, provide a little bit info on that. – Justin Jose Mar 29 '17 at 09:31
  • For example, If i have List property, i want to check the list is not empty before proceeding with json response. As well, when a service is called for that i want a,b property only. If someother service is called, then i want to properties b,c – Yoga Mar 29 '17 at 09:43

0 Answers0