Here's my JSON:
{
firstName: 'Somebody',
lastName: 'Else'
}
And I deserialize it into JsonElement
using these options:
var options = new JsonSerializerOptions {
WriteIndented = true,
PropertyNameCaseInsensitive = true,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
};
But then I want to search for properties, it becomes case-sensitive.
element.GetProperty("FirstName") // this returns null
element.GetProperty("firstName") // this returns 'Somebody'
How can I force GetProperty
method to become case-insensitive?