I’m building an application based on Spring 3 and i’m wondering, is there any Spring library for creating JSON ans XML object?
Let say, that i want to create and XML or JSON with a variable and send it to webservice.
I was looking in google, but i dodn’t found anything special.
Coult you help me?
For creating XML objects you should use JAXB and
spring-oxmproject. They simplify XML handling significantly.For JSON, Jackson library is used most commonly.
Note that if you want to consume or product XML/JSON from Spring MVC, just expect/return Java objects in your controllers. Spring will do the marshalling and unmarshalling for you. XML is for free, JSON support will be enabled automatically if Jackson is available.
Finally if you want to be a client of SOAP web service, try
spring-ws. If this is a REST service,RestTemplatewas designed especially for you.