This is in the POSTMAN request body:
{
"roles":
[
{
"role_id": "TEST1",
"role_name": "Для тестов"
},
{
"role_id": "TEST3",
"role_name": "Для тестов
}
]
}
Model as it is :
public class Role
{
[JsonProperty(PropertyName = "role_id")]
public string role_id { get; set; }
[JsonProperty(PropertyName = "role_name")]
public string role_name { get; set; }
}
Controller api-method – an Error appeared in Request
HttpPost("[action]/")]
public ActionResult<UserReply> SetRoleMessage(string message_text, List<Role> roles)
{
//CODE
}
HERE is Postman results with an Error :

>Solution :
You send in an object with a property "roles" which is an array. But what your controller expects is that you send in an array.
Update your body to
[
{
"role_id": "TEST1",
"role_name": "Для тестов"
},
{
"role_id": "TEST3",
"role_name": "Для тестов"
}
]
As a side note, I would also use [FromQuery] and [FromBody] in your controller method to make more clear what is what:
public ActionResult<UserReply> SetRoleMessage([FromQuery] string message_text, [FromBody] List<Role> roles)