I'm trying to receive a JSON String with subdomain to a Java Map at Spring MVC Controller.
Let's say I have this JSON at the JavaScript part:
var contract = {dateFrom:someDate,
dateTo:someDate,
season: {seasonCode:someString}}
The JSON is sent as GET Ajax call.
The Controller looks like this:
@RequestMapping(value = "/", method = RequestMethod.GET, headers = "Accept=application/json")
public ResponseEntity<String> getVertagFromSearch(@RequestParam Map<String, Object> allRequestParams, ModelMap model){
The output of the Map looks like this:
{dateFrom=02-07-2014, dateTo=02-07-2014, season[seasonCode]=SO03}
The GET Request looks like this:
http://localhost:8080/contracts/?dateFrom=02-07-2014&dateTo=02-07-2014&season%5BseasonCode%5D=SO03
I want to parse this Map into my contract domain object. But with this structure it doesnt work. Without a subdomain(season) it worked.
Thanks in advance!
Update 1
Sending as an object it looks like this: (output Browser)
Object { dateFrom: "09-07-2014", dateTo: "08-07-2014", season: Object }
Sending after JSON.stringify it looks like this:
"{"fromDate":"09-07-2014","dateTo":"08-07-2014","season":{"saiCode":"SO03"}}"
In this case I think the probem are the double quotes at the beginning and at the end.