I just want to add this extra related information which might help others.
System.Text.Json.JsonSerializerOptions has a property called PropertyNamingPolicy
And the value can either be null or JsonNamingPolicy.CamelCase
So if it is set then C# PascalCase properties are converted to JavaScript camelCase names in the generated json. This can create unexpected problems when serializing and deserializing data as names do not match.
The problem can partly be overcome by setting PropertyNameCaseInsensitive = true in the options. Then you can serialize and deserialize in a case insensitive way.
However, if you are writing a custom JsonConverter then you may also need to find a property by the case sensitive name using JsonDocument.RootElement.TryGetProperty(). And for this you'll need to check for both the PascalCase and camelCase variations of the name to make it compatible with different options settings.
Lastly, JsonSerializerOptions has some presets that will automatically enable camelCase. For example, this JsonSerializerDefaults.Web preset automatically enables camelCase.
public JsonSerializerOptions Options = new JsonSerializerOptions(JsonSerializerDefaults.Web)
{
WriteIndented = true,
Converters = { new MyCustomTypeConverter() }
};