Skip to content Skip to sidebar Skip to footer

Cannot Deserialize The Current Json Array (e.g. [1,2,3]) Into Type 'tenantmanagementwebapi.entities.tenant

I have the following error: JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'TenantManagementWebApi.Entities.Tenant' because t

Solution 1:

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 }));

Post a Comment for "Cannot Deserialize The Current Json Array (e.g. [1,2,3]) Into Type 'tenantmanagementwebapi.entities.tenant"