添加项目文件。
This commit is contained in:
26
Atomx.Utils/Json/JsonOptions.cs
Normal file
26
Atomx.Utils/Json/JsonOptions.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Atomx.Utils.Json.Converts;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Text.Json;
|
||||
using System.Text.Unicode;
|
||||
|
||||
namespace Atomx.Utils.Json
|
||||
{
|
||||
public class JsonOptions
|
||||
{
|
||||
public static JsonSerializerOptions DefaultOptions()
|
||||
{
|
||||
|
||||
var opts = new JsonSerializerOptions
|
||||
{
|
||||
PropertyNameCaseInsensitive = true,
|
||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
||||
WriteIndented = true,
|
||||
Encoder = JavaScriptEncoder.Create(UnicodeRanges.All)
|
||||
};
|
||||
opts.Converters.Add(new LongJsonConverter());
|
||||
opts.Converters.Add(new DateTimeJsonConverter());
|
||||
opts.Converters.Add(new ClaimConverter());
|
||||
return opts;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user