JSON Serialization and Deserialization - C#

Overview

This article documents notes about serializing and deserializing object to and from JSON.

Prerequisites


Code

using System.Text.Json;

/* Serialize */
var json = JsonSerializer.Serialize(myObject);

/* Deserialize */
var myObject = JsonSerializer.Deserialize<MyClass>(json)