In a perfect world, you’d have to write zero
JsonConverter classes, as all JSON data would serialize and deserialize as expected. Unfortunately, we live in a world where folks make bespoke formatting decisions that can boggle the mind. For folks using
System.Text.Json, you’ll likely have to write a
JsonCoverter to deal with these choices. When writing converters, you’ll want a test suite to ensure you’ve caught all the edge cases and to limit exceptions.
In this post, I’ll provide extension methods that make it a breeze to test any
JsonConverter and a bonus class that makes it simpler to deal with double-quoting values.