-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Text.Json
Milestone
Description
JsonConverterAttribute does not contain target AttributeTargets.Interface. I did not find any design notes about this behavior.
It's strange that JsonConverterAttribute can be applied to abstract classes, but not to interfaces.
In fact, JsonConverterAttribute can be used on property of an interface type, and it will work as expected. Also, specific JsonConverter that works with an interface type can be added to JsonSerializerOptions, and will work as expected.
Similar issue about enums: #30361
EDIT: See #33112 (comment) for the API proposal.
Groxan, MaceWindu and vslee
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Text.Json