I have a Post method that receives a fairly simple JSON:
{ "First": "John", "Last": "Smith" }
But I need it as a string.
I've tried casting the JSON to a string but it comes up null.
public void Post([FromBody]string jsonData)
{
...
}
I would like to use jsonData as a string. I am trying to avoid creating a class with field names matching the JSON because that would mean changing the API every time a field is added. I just need to receive the JSON as a string at the outset. Is there a way to cast it as such at the endpoint without using variable names?