When serializing C# objects to JavaScript Object Notation (JSON), by default, all public properties are serialized. If you don't want some of them to appear in the resulting JSON, you have several options. In this video, James and Matt show you all of the built in options you can use to control this.
Chapters:
00:00 - What are extra JSON properties
01:30 - Ignoring a single property with JsonIgnore
04:00 - Ignoring read only fields and properties
05:30 - Ignoring default and null values
09:08 - JsonIgnore Conditions
12:40 - Always ignore everything
14:00 - Wrap-up
Resources:
Docs: https://learn.microsoft.com/dotnet/standard/serialization/system-text-json/ignore-properties
Connect with .NET:
Blog: https://aka.ms/dotnet/blog
Twitter: https://aka.ms/dotnet/twitter
TikTok: https://aka.ms/dotnet/tiktok
Mastodon: https://aka.ms/dotnet/mastodon
LinkedIn: https://aka.ms/dotnet/linkedin
Facebook: https://aka.ms/dotnet/facebook
Docs: https://learn.microsoft.com/dotnet
Forums: https://aka.ms/dotnet/forums
🙋♀️Q&A: https://aka.ms/dotnet-qa
👨🎓Microsoft Learn: https://aka.ms/learndotnet
#dotnet