| Feature | Newtonsoft.Json | System.Text.Json | |---------|----------------|------------------| | Default property name casing | Preserved | camelCase | | Non-public members | Can serialize with opt-in | Not supported | | Dictionary with non-string keys | Serializes as JSON object | Throws or requires converter | | Cyclic references | ReferenceLoopHandling.Ignore | Not supported | | DateTime handling | ISO by default | Strict ISO (no legacy formats) |

var settings = new JsonSerializerSettings

So pour one out for the DLL that refused to die. And then maybe add a reference to it, because your appsettings.json file still needs parsing. Have a Newtonsoft war story? A custom converter that saved your bacon? Share it in the comments below.

public override void WriteJson(JsonWriter writer, DateTime value, JsonSerializer serializer) => writer.WriteValue((value - new DateTime(1970, 1, 1)).TotalSeconds); public override DateTime ReadJson(JsonReader reader, Type objectType, DateTime existingValue, bool hasExistingValue, JsonSerializer serializer) => new DateTime(1970, 1, 1).AddSeconds(Convert.ToDouble(reader.Value)); You don't always have a strongly-typed class. Sometimes you need to parse, query, or modify JSON on the fly. Newtonsoft’s JObject lets you treat JSON like an XML DOM.