I'm looking for a way to "unwrap" JSON that's been posted to a MVC Core service. Let's say, I have the following method:
[HttpPost]
public dynamic SayHello(string FirstName, string SecondName)
{
return $"Hello {FirstName} {SecondName} !";
}
And I post in the following JSON:
{
"FirstName":"Joe",
"SecondName": "Bloggs"
}
I'd expect to get a response of Hello Joe Bloggs !, but I cannot seem to find an easy way to unwrap the JSON object into the properties of the method.
I know the correct solution is to have a HelloModel with those two properties in, slap on a [FromBody] attribute, but for reasons this isn't possible.