using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Collections.ObjectModel;
using System.Text.Json.Serialization;
public class MyClass : IJsonOnDeserialized
void IJsonOnDeserialized.OnDeserialized() => PostSerialisation();
internal void PostSerialisation()
Console.WriteLine("PostSerialisation() called");
PostSerialisationCalled = true;
public bool PostSerialisationCalled { get; private set; }
public static void Test()
var myClass = JsonSerializer.Deserialize<MyClass>("{}");
Assert.IsTrue(myClass?.PostSerialisationCalled);
public static void Main()
Console.WriteLine("Environment version: {0} ({1}), {2}", System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription , Environment.Version, Environment.OSVersion);
Console.WriteLine("System.Text.Json version: " + typeof(JsonSerializer).Assembly.FullName);
Console.WriteLine("Failed with unhandled exception: ");