Skip to content

Allow (de)serialization of abstract types with JsonSerializer when there is a JsonConverter for that type #446

@LeroyK

Description

@LeroyK

Issue Title

Allow (de)serialization of abstract types with JsonSerializer when there is a JsonConverter for that type

General

When you try to serialize or deserialize a type that is abstract, System.Text.Json.JsonSerializer currently throws a NotSupportedException with the message:

Deserialization of reference types without parameterless constructor is not supported.

JsonSerializer should first check if the list of JsonConverters supports the abstract type and throw this exception only when there is no JsonConverter capable of converting the type.

We currently have a JsonConverter that supports polymorphism and because of this issue we cannot make the base type abstract.

Additional info

.NET Core version: 3.0.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions