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