Skip to content

DevBetterCom/DevBetter.JsonExtensions

Repository files navigation

NuGetNuGet

DevBetter.JsonExtensions

Some extensions to add more features to text.json.

Give a Star! ⭐

If you like or are using this project to learn or start your solution, please give it a star. Thanks!

Credits

Big thanks to all of the great contributors to this project!

Getting Started

Install DevBetter.JsonExtensions from Nuget using:

(in Visual Studio)

Install-Package DevBetter.JsonExtensions

(using the dotnet cli)

dotnet add package DevBetter.JsonExtensions

SetMissingMemberHandling

Will help to not go to exception when the property set to {} in json.
You can enable it by calling SetMissingMemberHandling.

var jsonString = @"{""Id"":5, ""Title"": ""Title"",""TemperatureC"": 28,""CreatedDate"": {}, ""Days"": [""Sunday""]}";
var deserializeOptions = new JsonSerializerOptions()
    .SetMissingMemberHandling(MissingMemberHandling.Ignore);

var weatherForecast = JsonSerializer.Deserialize<WeatherForecast>(jsonString, deserializeOptions);

Please check the unit tests for more examples here

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages