Why do we need jackson databind?


I am new in Spring MVC. My question is, why do we need jackson databind? Because We can receive the Request Params by @ModelAttribute and requests through http PUT or POST by @RequestBody. I can’t find a reason why we need jackson databind to convert json/xml to POJO or vice versa.



Why do we need jackson databind?

Because representing structured data is much easier using XML (or JSON) than using simple name-value pairs.

Because it is more convenient to send and receive JSON from the client side when you are doing AJAX.

Because once you have to deal with sending and receiving JSON or XML in the server side Java app, it is more convenient to deal with structured data as POJOs.

None of the above points mean you have to use a binding. There are other ways of dealing with each of the above. But many Java developers think that data bindings the better way to go: more efficient in terms of developer time, and more reliable. Especially if you are implementing services with a complex APIs. That’s why they are popular.

And as other answers/comments point out, if you are using @RequestBody, then that is using a binding library under the hood to give you the POJOs. In the case of Spring, it is Jackson that is being used.

Answered By – Stephen C

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published