Skip to content

SystemTextJsonSerializer doesn't use JsonSerializerOptions to deserialize #405

@fstanis

Description

@fstanis

I'm trying to use this library in an AOT project which doesn't support reflection-based JSON serialization and came across an issue where deserializing doesn't use the same JsonSerializerOptions that's passed in the constructor for SystemTextJsonSerializer.

var newMessage = JsonSerializer.Deserialize<JsonMessage>(text, new JsonSerializerOptions
{
NumberHandling = JsonNumberHandling.AllowReadingFromString,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
});

This unfortunately makes it impossible to provide a TypeInfoResolver. Would it be OK to use the passed _options object here instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions