I have found that the proposed way of serializing and deserializing JSON to a controller commonly has ObjectMapper problems. I prefer to be totally in control of the POST body of the JSON message so I use this pattern instead:
First The JQuery Part, this method posts a JQUERY json model which is the options for a query, and then places the JSON results into a selectable list.
Now we build the controller that will parse that json request and create a JSON View back. This does the work of parsing the JSON and then generating a model that we sent to a template. Yes a template.
Great. Now lets set up the MVC config and view and make sure that we map the extension ".json" to a velocity view. We will need a been that is extension away so we have total control over how our view serializes. Make sure to include the Velocity configuration. This pattern is about control.
The view itself:
And this is the custom resolver that lets us make sure we can serialize the way we want based on extension.
Lets make our Velocity template now: