JAX-RS, Map to JSON without the overhead?

前端 未结 3 635
孤独总比滥情好
孤独总比滥情好 2020-12-09 13:07

I\'m using JAX-RS to create restful webservices in Java. I am getting to much overhead in the produced JSON.

Data class:

@XmlRootElement
@XmlAccessor         


        
3条回答
  •  情深已故
    2020-12-09 13:40

    "JAXB spec defines a special handling for Map when it's used as a property of a bean."

    In light of that, I don't think there is much you can do (currently) except, perhaps, to write your own MessageBodyWriter (https://jsr311.dev.java.net/nonav/javadoc/javax/ws/rs/ext/MessageBodyWriter.html)

提交回复
热议问题