0

As per code given i want to remove few fields from in ResultJSON. In field I am going pass list of ResultBean.

I am setting fields in result field like resultJson.setResult(ResultBeanList)

Note: ResultBean is not a JSON object. It simple Java bean. Hope You understand my issue.

public class ResultJson<T> {
    private Integer success;
    private T result;
    private String message;
    private String errorCode;   
}

public class ResultBean implements Serializable {
    private static final long serialVersionUID = 1L;
    private String customerName;
    private String customerCode;
    private String customerAlias;
    private String pOR;
    private String pOD;
}

We can skip/remove fields in JSON but question how can we delete fields from inside of JSON fields.

bt_coder
  • 1
  • 2
  • are those "fields" you want to delete from JSON are NULL or NON NULL? – ScanQR Aug 19 '19 at 07:42
  • Possible duplicate of [Ignore fields from Java object dynamically while sending as JSON from Spring MVC](https://stackoverflow.com/questions/23101260/ignore-fields-from-java-object-dynamically-while-sending-as-json-from-spring-mvc) – seenukarthi Aug 19 '19 at 07:55
  • @ScanQR they would be null and that's why want to hide/remove from json result but thing is that it(ResultBean) is not JSON object just setting(resultJson.setResult(ResultBeanList)) it to JSON object(ResultJson). – bt_coder Aug 19 '19 at 08:57

0 Answers0