using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
public string Title { get; set; }
public DateTime SomeTimestamp { get; set; }
public List<int> Numbers { get; set; } = new List<int>();
public static void Test()
myclass thing = JsonConvert.DeserializeObject<myclass>("{\"title\":\"some title\",\"timestamp\":\"2022-01-01T00:00:00.000Z\",\"numbers\":[1,2,3]}");
Assert.That(thing.Numbers.SequenceEqual(new [] { 1, 2, 3 }));
var json2 = JsonConvert.SerializeObject(thing);
Console.WriteLine("Re-serialized {0}:", thing);
Console.WriteLine(json2);
public static void Main()
Console.WriteLine("Environment version: {0} ({1}), {2}", System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription , Environment.Version, Environment.OSVersion);
Console.WriteLine("{0} version: {1}", typeof(JsonSerializer).Namespace, typeof(JsonSerializer).Assembly.FullName);
Console.WriteLine("Failed with unhandled exception: ");