refactor(AnnotationHandler): update to use System.Text.Json.JsonSerializer

This commit is contained in:
2025-09-10 15:38:05 +02:00
parent 4eb6d87770
commit e990a466aa
4 changed files with 23 additions and 18 deletions

View File

@@ -1,5 +1,9 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
#if NET
using System.Text.Json;
using System.Text.Json.Serialization;
#endif
namespace EnvelopeGenerator.Domain.Constants
{
@@ -8,18 +12,22 @@ namespace EnvelopeGenerator.Domain.Constants
#region Json Serializer Settings
public static class Json
{
//TODO: update to use System.Text.Json
public static readonly JsonSerializerSettings ForDiagnostics = new JsonSerializerSettings()
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
Formatting = Formatting.Indented,
NullValueHandling = NullValueHandling.Include
};
public static readonly JsonSerializerSettings ForAnnotations = new JsonSerializerSettings()
#if NET
public static readonly JsonSerializerOptions ForAnnotations = new()
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
Formatting = Formatting.None,
NullValueHandling = NullValueHandling.Ignore
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
WriteIndented = false,
DefaultIgnoreCondition = JsonIgnoreCondition.Never,
};
#endif
}
#endregion
}