jasontaylordev / CleanArchitecture

Clean Architecture Solution Template for ASP.NET Core

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Angular 17 post data to dotnet core8. Json deserialisation of bool failed

1988gadocansey opened this issue · comments

MacOS ventura (M1)
Dotnet 8
Angular 17

---> Microsoft.AspNetCore.Http.BadHttpRequestException: Failed to read parameter "CreateBiodataRequest command" from the request body as JSON.
---> System.Text.Json.JsonException: The JSON value could not be converted to System.Nullable`1[System.Boolean]. Path: $.residentialStatus | LineNumber: 0 | BytePositionInLine: 451.
---> System.InvalidOperationException: Cannot get the value of a token type 'String' as a boolean.
at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_ExpectedBoolean(JsonTokenType tokenType)

the json is below.

{
"id": 1,
"firstName": "MM",
"lastName": "MM",
"title": "0",
"previousName": "OCANSEY",
"otherName": "N",
"phone": "0243348522",
"altPhone": "0243348522",
"noOfChildren": 12,
"day": "4",
"year": "2005",
"month": "2",
"maritalStatus": "0",
"gender": "0",
"email": "GADOCANSEY@GMAIL.COM",
"emergencyContact": "0243348522",
"hometown": "CAPE COAST",
"postGprs": "OCANSEY",
"district": "1",
"nationalIDType": "0",
"nationalIDNo": "12",
"regionId": "1",
"nationalityId": "2",
"residentialStatus": "true",
"disability": "true",
"disabilityType": "0",
"sourceOfFinance": "OCANSEY",
"religionId": "1",
"denomination": "1",
"referrals": "Print Media",
"sponsorShipCompany": "",
"sponsorShipLocation": "",
"sponsorShipCompanyContact": "",
"guardianName": "OCANSEY",
"guardianPhone": "0243348522",
"guardianOccupation": "OCANSEY",
"guardianRelationship": "PARENT",
"languages": [
"2"
]
}