Skip to content
This repository was archived by the owner on Feb 1, 2020. It is now read-only.

Commit d751215

Browse files
committed
Update json
1 parent aff64c7 commit d751215

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
using Newtonsoft.Json;
2+
using Newtonsoft.Json.Converters;
23

34
namespace NeoStatsPlugin.Extensions
45
{
56
public static class JsonExtensions
67
{
8+
private static readonly JsonSerializerSettings _settings = new JsonSerializerSettings()
9+
{
10+
Formatting = Formatting.None,
11+
};
12+
13+
/// <summary>
14+
/// Static constructor
15+
/// </summary>
16+
static JsonExtensions()
17+
{
18+
_settings.Converters.Add(new StringEnumConverter() { });
19+
}
20+
721
/// <summary>
822
/// Convert to json
923
/// </summary>
10-
public static string ToJson(this object obj) => JsonConvert.SerializeObject(obj, Formatting.None);
24+
public static string ToJson(this object obj) => JsonConvert.SerializeObject(obj, _settings);
1125
}
1226
}

src/NeoStatsPlugin/NeoStatsPlugin.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<ItemGroup>
88
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
9-
<PackageReference Include="Neo" Version="2.10.1" />
9+
<PackageReference Include="Neo" Version="2.10.2.1" />
1010
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
1111
</ItemGroup>
1212

0 commit comments

Comments
 (0)