I am newbie to WEB API2 and JSON overall. I have a JSON body like this
{
"Input_data": {
"method": "check",
"hashcode": " xxxxxx ",
"accountId": "11111111",
}
}
How could I retrieve values from POST request?
I have model like this
[JsonArray]
public class BaseInput
{
[JsonProperty(PropertyName = "method")]
public string Method { get; set; }
[JsonProperty(PropertyName = "hashcode")]
public string hashCode { get; set; }
[JsonProperty(PropertyName = "accountid")]
public int accountId { get; set; }
}
And controller code like this
BaseOutput ApiReqeust(int partnerId,[FromBody] BaseInput Input_data)
And Input_data is always null.
What am I doing wrong?
partnerIdvalue? And maybe post your route config for the method.[JsonArray]? Your model class does not look like an array at all. Not sure if it causes this problem, but even if it is unrelated, I still find it strange.