Why do we need jackson databind?

Niaz Ahsan :

I am new in JAVA EE. 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.

Thanks.

Stephen C :

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.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=131372&siteId=1