So I have been harldy looking for an answer to this with no success.
I want to receive a "complex" param as JSON at my GET method.
How could I do it?
This is the method:
@RequestMapping(method = RequestMethod.GET, value = "/test2", consumes = {MediaType.APPLICATION_JSON_VALUE})
@ResponseBody
public ResponseEntity<?> test2(@RequestParam PojoParam pojoParam) {
    return new ResponseEntity<>(pojoParam, HttpStatus.OK);
}
This is the PojoParam:
public class PojoParam implements java.io.Serializable {
    private String stringVariable;
    private int intVariable;
    public PojoParam() {
    }
    public String getStringVariable() {
        return stringVariable;
    }
    public int getIntVariable() {
        return intVariable;
    }
    public void setStringVariable(String stringVariable) {
        this.stringVariable = stringVariable;
    }
    public void setIntVariable(int intVariable) {
        this.intVariable = intVariable;
    }
}
Invoke example:
... /test2?pojoParam={intVariable:2, stringVariable:"as"}
Response example:
{
    "timestamp": "2016-06-16T15:09:36Z",
    "status": 500,
    "error": "Internal Server Error",
    "exception": "org.springframework.beans.ConversionNotSupportedException",
    "message": "Failed to convert value of type 'java.lang.String' to required type 'com.htravel.tng.pe.resources.PojoParam'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [com.htravel.tng.pe.resources.PojoParam]: no matching editors or conversion strategy found",
    "path": "/rest/availability/test2"
}
I have tried with @RequestPart too without succes.
Any suggestions?
Thank you.
 
     
    