Jackson vs Jaxb, which is better for json

Interestingly, if it is better for json jackson vs jaxb. I did a study and I found out (maybe I'm wrong) that we should not use jaxb to convert json (problem with some schemes). On the other hand, is jaxb better for xml? thanks for the help

+5
source share
1 answer

As the JacksonFAQ website says :

Jackson is "100% JSON" and does not attempt to simulate or emulate XML. Property name mapping is based on the standard Java Bean naming convention (although it can be overridden using annotations or a custom naming strategy).

There are some compatibility support features, such as the ability to arbitrarily use JAXB annotations, but in principle Jackson is a pure JSON / Java dataperper and tries to minimize the resistance between JSON and Java data models.

And he continues JacksonFaq # JAXB :

Jackson supports some level of compatibility with the JAXB API (javax.xml.bin):

With Jackson 1.1, you can use JAXB annotations in addition to (or instead of) Jackson's main annotations

JAXB API , stands for Java Architecture for XML binding, using JAXB annotation to convert a Java object to / from an XML file

JAXB ships in JDK 1.6 and above , so there is no need to add any other banks.


Here is a test that says Jackson is faster, but I have not tested the code and its results. Test

+10
source

Source: https://habr.com/ru/post/1214805/


All Articles