I have the following error:
JsonSerializationException: Cannot deserialize the current JSON array (e.g.
[1,2,3]
) into type\'Tenant
Your model
gets posted in its string
representation, which is not JSON
.
await modelContent.ReadAsStringAsync()
will return a string in array-notation: [object Object]
.
You'll have to take care of the JSON serialization yourself.
Replace
data.append("model", { "TenantId": this.state.TenantId, "TenantUrl": this.state.TenantUrl, "TenantPassword": this.state.TenantPassword });
with
data.append("model", JSON.stringify({ "TenantId": this.state.TenantId, "TenantUrl": this.state.TenantUrl, "TenantPassword": this.state.TenantPassword }));