I have the following model objects
[DataContract]
public class Filter
{
[DataMember (Name ="start")]
public int Start { get; set; }
[DataMember (Name="rows")]
public int Rows { get; set; }
[DataMember(Name = "geoloc")]
public GeoLocationModel GeoLocation { get; set; }
}
[DataContract]
public class GeoLocationModel
{
[DataMember(Name = "lat")]
public double Latitude { get; set; }
[DataMember(Name = "lng")]
public double Longitude { get; set; }
}
and the following action
[HttpGet]
public async Task GetCities([FromQuery]Models.Filters.Filter filters)
{
//some code
}
When I call my action with the following query (query generated by axios):
/api/cities/?start=0&rows=5&geoloc=%7B%22lat%22:44,%22lng%22:3%7D
Parameters Start and Rows are filled correctly but GeoLoc is null.
How do I need to format my query to satisfy FromQuery Attribute?
/api/cities/?start=0&rows=5&geoloc.lat=44&geoloc.long=3