Skip to content

Improve feature parity between JsonSerializerOptions and JsonSourceGenerationOptionsAttribute #57321

@ithline

Description

@ithline

EDIT See #57321 (comment) for an API proposal.

Original Proposal

Currently source generator for JSON serialization in `System.Text.Json` creates a static property named `Default` that receives default `JsonSerializerOptions` defined by the source generator. These can be modified by using `JsonSourceGenerationOptionsAttribute`, but several options are missing and cannot be set, e.g. `PropertyNameCaseInsensitive`, `NumberHandling`, `DictionaryKeyPolicy`...

It would be really helpful if these missing options could be added to the JsonSourceGenerationOptionsAttribute or at least disable generating of the Default property, so we could provide our own configuration for the default instance.

Metadata

Metadata

Labels

api-approvedAPI was approved in API review, it can be implementedarea-System.Text.JsonblockingMarks issues that we want to fast track in order to unblock other important workpartner-impactThis issue impacts a partner who needs to be kept updatedsource-generatorIndicates an issue with a source generator feature

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions