Skip to content

Commit

Permalink
🎨 SystemTextJsonSerializerOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
AigioL committed Oct 28, 2024
1 parent a059db5 commit 55e8b36
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/BD.Common8.Bcl/Serializable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public static SystemTextJsonSerializerOptions CreateOptions(
baseOptions = new(baseOptions);
}

// https://learn.microsoft.com/zh-cn/dotnet/standard/serialization/system-text-json/configure-options?pivots=dotnet-8-0#web-defaults-for-jsonserializeroptions
baseOptions.PropertyNameCaseInsensitive = true;
baseOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
baseOptions.NumberHandling = JsonNumberHandling.AllowReadingFromString;

baseOptions.Converters.Add(new CookieConverter());
baseOptions.Converters.Add(new CookieCollectionConverter());
baseOptions.Converters.Add(new CookieContainerConverter());
Expand Down

0 comments on commit 55e8b36

Please sign in to comment.