What is Spring-Json View?

Spring-Json View adds JavaScript Object Notation (JSON) support to Spring-MVC. It is deeply integrated into the Spring-MVC module and can be used with a variety of standard controllers.

In the J2EE world Spring-MVC has become a popular model-view-controller framework for web applications providing better separation of concerns than the older Struts framework. In this age of Web 2.0 Ajax is a commonly used to communicate between clients (typically Browsers) and servers. When we looked for a way to use our Spring-MVC knowledge to create Ajax request targets there was nothing that could satisfy a fastidious Spring-MVC developer so we started to think about a Spring Json view which supported all Spring-MVC features.

Features

Configuration
It can be configured the Spring way!
Binding
Supports the Spring way by converting bean property values for the view. (Please see the initBinder() method of the SimpleFormController)!
Integration of common Json generators
Currently supports SOJO by default, the JSON-lib and XStream.
Validating
Supports validation by ValidatorBeans!
Errorhandling
It supports Spring error handling including global, field and binding errors!
Exceptionhandling
Exception handling using a JsonExceptionResolver!

This way you are able to swap a "classic" Spring application for a Web 2.0 application by just changing the view while keeping the back-end unchanged.

Alternatives?

There are other projects which aim to provide Spring-MVC with Json capabilities. For example the Json-lib4Spring project which like Spring-Json builds on the JSON-Lib library.

Since release 3.0.0.M4 the springframework provides an own json-view (MappingJacksonJsonView). It's based on the http://jackson.codehaus.org/. For further information see a Comparison of the MappingJacksonJsonView and spring-json view

Status

Spring-Json 1.3.1 released

  1. Bug fixed: Patch PropertyEditorRegistryValueProcessor from Sergiusz Urbaniak und Martin Ober. Thanx
  2. Bug fixed: SimplePropertyFilter removes converters of ConvertUtilsBean reported from Gerardo Costilla
  3. Attention spring-json view mailinglists are closed Please use the Help-Forum for requests.

Spring-Json 1.3.1 added to maven 2 central and project repository

  1. maven 2 central repository

    http://repo1.maven.org/maven2

  2. project repository

    http://spring-json.sourceforge.net/repository