1

How to exclude Json tab field when it has no value being authored in component dialog field (Sling model)?

dialog

  • a (authored value) tab
  • b (not authored) tab

json response with model.json of experience fragment

"Component" : {
   "a":{
         "field":"authored value"

       },
   "b": {
         "field": null
        }
}

I am expecting to be removed from json response if it is not authored.

"Component" : {
   "a":{
         "field":"authored value"
       }
  }

1 Answers1

0

You can use all Jackson Annotations (com.fasterxml.jackson.annotation) to modify JSON output. In your case:

@JsonInclude(JsonInclude.Include.NON_NULL)
public String getA() {....}
Alexander Berndt
  • 1,628
  • 9
  • 17