mirror of
https://github.com/Tribufu/TribufuDotNet
synced 2026-08-09 12:51:06 +00:00
Update CustomSerializerSettings
This commit is contained in:
parent
672fe601f7
commit
e8d842bf34
1 changed files with 4 additions and 9 deletions
|
|
@ -1,33 +0,0 @@
|
|||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace Tribufu.Serialization
|
||||
{
|
||||
public static class SerializationConfiguration
|
||||
{
|
||||
public static JsonSerializerSettings GetNewtonsoftJsonSerializerSettings()
|
||||
{
|
||||
var settings = new JsonSerializerSettings
|
||||
{
|
||||
ContractResolver = new BaseClassFirstContractResolver
|
||||
{
|
||||
NamingStrategy = new SnakeCaseNamingStrategy()
|
||||
},
|
||||
};
|
||||
|
||||
settings.Converters.Add(new DecimalNullableStringConverter());
|
||||
settings.Converters.Add(new DecimalStringConverter());
|
||||
settings.Converters.Add(new ULongNullableStringConverter());
|
||||
settings.Converters.Add(new ULongStringConverter());
|
||||
settings.Converters.Add(new StringEnumConverter(new SnakeCaseNamingStrategy(), false));
|
||||
|
||||
settings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
|
||||
|
||||
return settings;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue