Stack Exchange
how to resolve url parameters in spring boot controller
--this is my url 
http://localhost:8080/estates?pageCount=3&pageIndex=2&multiSelector={roomCountRanges:[{from:3,to:3},{from:4,to:4}]}

--here is my controller code:
Controller Code
**--error I am seeing **
 Field error in object 'myModel' on field 'multiSelector': rejected value [{roomCountRanges:[{from:3,to:3},{from:4,to:4}]}];
        codes [typeMismatch.myModel.multiSelector,typeMismatch.multiSelector,typeMismatch.com.centanet.service.model.MultiSelector,typeMismatch];
        arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [myModel.multiSelector,multiSelector];
        arguments []; default message [multiSelector]];
        default message [Failed to convert property value of type 'java.lang.String' to required type 'com.centanet.service.model.MultiSelector' for property 'multiSelector';
        nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'com.centanet.service.model.MultiSelector' for property 'multiSelector': no matching editors or conversion strategy found], 

any ideas?
many thanks
1: 

in Your url you are passing Request Params as all properties but Model is expecting body as like below: so create a Model class, set all values and then call controller with passing model class.
{
  "pageCount": 3,
  "pageIndex": 2,
  "multiSelector": {
    "roomCountRanges": [
      {
        "from": 3,
        "to": 3
      },
      {
        "from": 4,
        "to": 4
      }
    ]
  }
}


You can use code like below:
@PostMapping
public void test(@RequestBody MyModel model) {
}
Dont pass the multiSelector as URL parameter, instead send this json via Request body. 

If you do not want to pass multiSelector as request body, you may want to read it as string in controller and then use Gson or Jackson to convert it to java object.
Gson gson = new Gson(); 
gson.fromJson(multiSelector, MultiSelector.class);

However, I would pass JSON as request body.
