using System.Text.Json; /* Serialize */ var json = JsonSerializer.Serialize(myObject); /* Deserialize */ var myObject = JsonSerializer.Deserialize<MyClass>(json)