foxcord/Foxcord/Serialization/JsonSerializerExtensions.cs

19 lines
477 B
C#
Raw Normal View History

2024-09-03 00:07:12 +02:00
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Foxcord.Serialization;
public static class JsonSerializerExtensions
{
public static JsonSerializerOptions CreateSerializer()
{
var opts = new JsonSerializerOptions
{
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower,
NumberHandling = JsonNumberHandling.AllowReadingFromString,
IncludeFields = true
};
return opts;
}
}