I have a model with a List<string> Parameters {get; set;} property, so when I send from postman a json like this
{
...,
"Parameters" :
[
["FirstParam"],
["SecondParam"]
],
...
}
I receive null in my controller method, I mean the requestModel is null
public JsonResult GetBalances([FromBody]RequestModel requestModel)
{
...
}
I know that "Parameters" is the problem because when I send without it, I receive the model normally.
How can I receive a list of parameters(string) from a json format?
PD. It works when I create a model like
public class RequestModel
{
...
public List<Parameters> Parameters {get;set;}
}
public class Parameters
{
public string Name {get;set;}
}
And the json
{
...,
"Parameters" : [
{"Name": "FirstParameter"},
{"Name":"SecondParameter"}
]
...
}
But I wonder if it is possible get it without create a class. Thanks in advance.