Episode

Welcome to System.Text.Json - How to read & write .NET objects as JSON

with James Montemagno, Matt Soucoup

James and Matt walk through the basics of System.Text.Json to read and write .NET objects as JSON! This amazing built in feature of .NET that nearly every app can utilize. Serialization is the process of converting the state of an object, that is, the values of its properties, into a form that can be stored or transmitted. The serialized form doesn't include any information about an object's associated methods. Deserialization reconstructs an object from the serialized form.

The System.Text.Json library design emphasizes high performance and low memory allocation over an extensive feature set. Built-in UTF-8 support optimizes the process of reading and writing JSON text encoded as UTF-8, which is the most prevalent encoding for data on the web and files on disk.

The library also provides classes for working with an in-memory document object model (DOM). This feature enables random access to the elements in a JSON file or string.

Chapters

  • 00:00 - Intro & What is JSON and System.Text.Json?
  • 03:00 - Writing/Serializing .NET Objects as JSON
  • 07:40 - Writing JSON Data to a File
  • 12:05 - Reading/Deserializing JSON as .NET Objects
  • 15:05 - Reading a JSON File to a .NET Object
  • 19:00 - Wrap-up and what's next

Additional resources

.NET