[Question] How to deserialize ignoring missing properties?
rafaelvascc opened this issue · 1 comments
rafaelvascc commented
Lets say i have a C# class like...
public class Person
{
public string FirstName {get;set;}
public string LastName {get;set;}
public int? Age {get;set;}
}
and i'm trying to deserialize the following json...
{
"firstName": "bob",
"age": 30
}
What i get is an object with all properties as null.
if it try to deserialize the following json...
{
"firstName": "bob",
"lastName ": "dylan",
"age": 30
}
I get the correct object with all properties.
Is there any way to deserialize a json text populating all existing properties and ignore the missing ones (the same behavior as Newtonsoft.Json)?
This is the only issue preventing us to fully replace Newtonsfot.Json with Utf8Json.
Thanks.
fcortese2 commented
@rafaelvascc
You marked this as closed, did you manage to find a workaround? If so, would you mind sharing? Having same issue changing from Newtonsoft.Json to Utf8Json...