-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
The naming policy seems to be ignored.
Changing the PropertyNamingPolicy to CamelCase has no effect, it does not throw an exception and returns the object with its defaults.
For example, this test fails:
[Fact]
public void SerializeProperlyWhenNamingPolicyIsNotTheDefault()
{
var jsonString = @"{""id"":3, ""title"": ""Title""}";
var deserializeOptions = new JsonSerializerOptions()
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
};
deserializeOptions.SetMissingMemberHandling(MissingMemberHandling.Error);
var response = JsonSerializer.Deserialize<WeatherForecast>(jsonString, deserializeOptions);
response.Title.ShouldBe("Title");
}But, it works if I remove the line:
deserializeOptions.SetMissingMemberHandling(MissingMemberHandling.Error);Metadata
Metadata
Assignees
Labels
No labels