C
C#8mo ago
James

JsonException missing required properties when they are there

"contact_inbox": {
"id": 4,
"contact_id": 4,
"inbox_id": 1,
"source_id": "f7b6c095-1356-47dd-b7ba-58cee0531175",
"created_at": "2023-11-27T14:04:07.619Z",
"updated_at": "2023-11-27T14:04:07.619Z",
"hmac_verified": false,
"pubsub_token": "h18bNijnqfjVLtsTNd17hGPq"
}
"contact_inbox": {
"id": 4,
"contact_id": 4,
"inbox_id": 1,
"source_id": "f7b6c095-1356-47dd-b7ba-58cee0531175",
"created_at": "2023-11-27T14:04:07.619Z",
"updated_at": "2023-11-27T14:04:07.619Z",
"hmac_verified": false,
"pubsub_token": "h18bNijnqfjVLtsTNd17hGPq"
}
public sealed record ContactInbox
{
public required int Id { get; init; }
public required int ContactId { get; init; }
public required int InboxId { get; init; }
public required string SourceId { get; init; }
public required string CreatedAt { get; init; }
public required string UpdatedAt { get; init; }
public required bool HmacVerified { get; init; }
}
public sealed record ContactInbox
{
public required int Id { get; init; }
public required int ContactId { get; init; }
public required int InboxId { get; init; }
public required string SourceId { get; init; }
public required string CreatedAt { get; init; }
public required string UpdatedAt { get; init; }
public required bool HmacVerified { get; init; }
}
JsonException: JSON deserialization for type 'MultipanelChatwootServer.Dtos.ContactInbox' was missing required properties, including the following: id, contact_id, inbox_id, created_at, updated_at, hmac_verified
9 Replies
Jimmacle
Jimmacle8mo ago
are you trying to deserialize that exact json to that exact model? because they don't match the contact_inbox: at the beginning would be incorrect also, share any relevant deserializer configuration/code
James
James8mo ago
It wouldn't let me edit the post, I'm using:
private readonly JsonSerializerOptions _jsonOptions = new ()
{
PropertyNameCaseInsensitive = true,
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower
};
private readonly JsonSerializerOptions _jsonOptions = new ()
{
PropertyNameCaseInsensitive = true,
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower
};
Jimmacle
Jimmacle8mo ago
so again is that the entire json you're deserializing? because that doesn't represent a ContactInbox, it represents some other object with a ContactInbox property
James
James8mo ago
No it's not Let me try deserialise it alone Yes it is a property Okay it deserialised fine by itself
Jimmacle
Jimmacle8mo ago
yeah so something is probably wrong in whatever model contains this property
James
James8mo ago
No description
James
James8mo ago
No description
James
James8mo ago
The root object is this:
No description
James
James8mo ago
I believe the account deserialised fine
Want results from more Discord servers?
Add your server
More Posts
✅ High quality list view iconsHow can i make my icons in ListView high quality while not resizing the row? (If i changed the size Blazor net 8 InteractiveServer mode problemI have .net 8 blazor app that enable the following ```xml @rendermode InteractiveServer @attribute [ActivatorUtilities.CreateInstance replacment for native AOTas in title, how can i replace ActivatorUtilities.CreateInstance function? right now it complain thaADO YAML - output variables troubleshootHi, I have pipeline, which compiles my app and publishes artifacts to azure, then I want to drop the✅ I want to work on the ongoing ASP.NET project as free or minimum salary.Hi, Nice to meet you everyone. As a experienced Web and Blockchian developer, now I am trying to lea✅ embed images in outputhi, I'm looking for a way to embed an image in the output in such a way that it's data is readable. Making an interpreter read custom filename extensionsI made an interpreter in Visual Studio (C#) for my own language. My question is, how do I make it soASP.NET Core 8 Web API, can't use additional fields with Identity registrationHello, It's my first time using Identity, so I came across some issues. When I input json data neceusing serilog (c#) in a vb.netHello, I have an old application which is written in vb.net. I'm searching for a sollution to use s✅ Why is a variable false in project in WPF .Net application even after it should be true?Hi I'm currently building my first C# project and could really need some help, I'm supposed to take