Skip to main content


Showing posts from March, 2010

How to control Date formatting when Jackson JSON Processor is used with Spring 3.0

If you have not already checked out Spring 3.0, I highly recommend that you do. They have introduced lots of new features in this release. Rest support in Spring MVC and being able to output XML and JSON formatted strings out of the box are few new features of this release. I recently set up a simple web application to try out few of these features. This web application had a simple controller that was being exposed as a REST service. I configured Spring 3.0 to use ContentNegotiatingViewResolver (more to come on this on later posts). With this and the built in support for JSON, this simple controller was able output JSON string in no time. Spring 3 by default uses Jackson JSON from with a MappingJacksonJsonView. One of the data fields that was getting outputted was java.util.Date. Jackson uses default strategy to determine date formatting in serialization. If you go to Jackson's website, you will see that there are few different ways to change the f