Skip to content

Add an option to use System.Text.Json instead of NewtonsoftJson #2777

@j-mok

Description

@j-mok

I'm wondering if there is currently any particular reason the platform uses NewtonsoftJson instead of the now-default System.Text.Json for ASP.NET MVC? Are there any particular customizations that would be difficult to pull of with System.Text.Json. PolymorphJsonContractResolver maybe?

I think it would be beneficial to allow VC instances to optionally use the default serializer. This has a number of advantages:

  • System.Text.Json tends to be faster
  • C# 11's required keyword is supported by System.Text.Json and helps in model validation
  • There are some promising source-generation techniques available with System.Text.Json that could help improve cold-start times in the AOT fashion

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions