🐛 Fixes embedding json loop
This commit is contained in:
@@ -14,6 +14,13 @@ namespace DysonNetwork.Shared.Proto;
|
||||
|
||||
public abstract class GrpcTypeHelper
|
||||
{
|
||||
public static readonly JsonSerializerOptions? SerializerOptionsWithIgnore = new JsonSerializerOptions()
|
||||
{
|
||||
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower,
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.Never,
|
||||
PropertyNameCaseInsensitive = true,
|
||||
}.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
|
||||
|
||||
public static readonly JsonSerializerOptions? SerializerOptions = new JsonSerializerOptions()
|
||||
{
|
||||
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower,
|
||||
|
@@ -31,7 +31,13 @@ public abstract class EmbeddableBase
|
||||
|
||||
public static Dictionary<string, object> ToDictionary(dynamic input)
|
||||
{
|
||||
var jsonRaw = JsonSerializer.Serialize(input, GrpcTypeHelper.SerializerOptions);
|
||||
return JsonSerializer.Deserialize<Dictionary<string, object>>(jsonRaw, GrpcTypeHelper.SerializerOptions);
|
||||
var jsonRaw = JsonSerializer.Serialize(
|
||||
input,
|
||||
GrpcTypeHelper.SerializerOptionsWithIgnore
|
||||
);
|
||||
return JsonSerializer.Deserialize<Dictionary<string, object>>(
|
||||
jsonRaw,
|
||||
GrpcTypeHelper.SerializerOptionsWithIgnore
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user