I have the requirement to return the result from the database either as a string in xml-structure or as json-structure. I\'ve got a solution, but I don\'t know, if this one
Whoa...when you're working with Spring, assume someone else has come up against the same issue. You can dump all the server-side JSON generation, because all you need to do is:
RequestMapping
return type to @ResponseBody(yourObjectType)
Spring will auto-magically convert your object to JSON. Really. Works like magic.
Doc for @ResponseBody
: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html#mvc-ann-responsebody