Customising Jersey JSON marshalling for java.util.Maps
By default, marshalling a @XmlRootElement
bean containing a map gives the structure:
myMap : {
entry : {
key : {
...
},
value : {
...
}
}
}
Is there any way to customise the JSON field names 'e开发者_运维百科ntry', 'key' and 'value'?
Use a custom @XmlJavaTypeAdapter
. @Blaise Doughan has a clearly-written tutorial on using them.
See also XmlAdapter
.
精彩评论