0

I have JSON fields defined as

@JsonProperty
private RestRingAttributeName name;

@JsonProperty
private String value;

in rest resource file.

Output I get is like,

   [ 
    {
      "name": "supplementalSystemId",
      "value": "FDFR_1485166326176"
    }
   ]

Is there any way like json annotation or something to get output as follows.

[ 
 {
   "supplementalSystemId": "FDFR_1485166326176",
 }
]

And not show name and value.

I am using jackson JSON.

atiqkhaled
  • 386
  • 4
  • 19
codingenious
  • 8,385
  • 12
  • 60
  • 90
  • 1
    You won't be able to get this, as Jackson uses the property's name as key while automatically serializing your objects. You will have to serialize it "by hand" to get that specific result. – DamCx Feb 08 '17 at 15:04
  • 1
    I got a way to do this, used `Map nvp` and `@JsonAnyGetter` and `@JsonAnySetter` annotations. – codingenious Feb 08 '17 at 16:03

0 Answers0