I am developing a Web API with .NET Core 2.1 where the response is manipulated based on the output received from a WCF service.
I need to have a API with Get verb and need to pass an array of complex objects as the input to it.The challenge currently I am facing is, the array is not getting detected from the input.I have added [FromQuery]
along with the input parameter. I am trying the same from Swagger UI.
Tried adding Name along with FromQuery .
[HttpGet("test")]
public IActionResult Testmethod([FromQuery] Person person)
{
return Ok(person);
}
Model classes:
public class Person
{
public string Name{ get; set; }
public int Age{ get; set; }
public Grade[] grades{ get; set; }
}
public class Grade
{
public int GradeId { get; set; }
public string GradeName { get; set; }
public string Section { get; set; }
}