Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Activout.RestClient.Newtonsoft.Json/NewtonsoftJsonDefaults.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;

namespace Activout.RestClient.Newtonsoft.Json;
Expand All @@ -12,11 +13,16 @@ public static class NewtonsoftJsonDefaults
MediaType.ValueOf("application/json")
];

public static readonly JsonConverter[] DefaultJsonConverters = [new SimpleValueObjectConverter()];
public static readonly JsonConverter[] DefaultJsonConverters =
[
new IsoDateTimeConverter(),
new SimpleValueObjectConverter(),
new StringEnumConverter(),
];

public static readonly DefaultContractResolver CamelCasePropertyNamesContractResolver = new DefaultContractResolver
{
NamingStrategy = new CamelCaseNamingStrategy()
NamingStrategy = new CamelCaseNamingStrategy(false, false)
};

public static readonly JsonSerializerSettings DefaultJsonSerializerSettings = new()
Expand All @@ -28,5 +34,6 @@ public static class NewtonsoftJsonDefaults
{
Converters = DefaultJsonConverters.ToList(),
ContractResolver = CamelCasePropertyNamesContractResolver,
NullValueHandling = NullValueHandling.Ignore
};
}
Loading