runtime: Don't forget about JsonSerializerOptions.CreateForWeb()

This is a leftover from https://github.com/dotnet/runtime/issues/32937, we didn’t add the default options that are meant to sync the options between System.Net.Http.Json and ASP.NET.

As per the spec, the next API should be added as well.

namespace System.Text.Json
{
    public partial class JsonSerializerOptions
    {
        public static JsonSerializerOptions CreateForWeb();
    }
}

Above method should return an options instance as the following:

new JsonSerializerOptions 
{ 
    PropertyNameCaseInsensitive = true, 
    PropertyNamingPolicy = JsonNamingPolicy.CamelCase 
}

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (17 by maintainers)

Most upvoted comments

This is one we only plan to do for 5.0, correct? (not in the blazor release)