🐛 Fix embeddable parsing

This commit is contained in:
2025-08-06 17:55:30 +08:00
parent 1105d6f11e
commit 4f2e18ca27
4 changed files with 11 additions and 12 deletions

View File

@@ -29,9 +29,9 @@ public abstract class EmbeddableBase
{
public abstract string Type { get; }
public Dictionary<string, object> ToDictionary()
public static Dictionary<string, object> ToDictionary(dynamic input)
{
var jsonRaw = JsonSerializer.Serialize(this, GrpcTypeHelper.SerializerOptions);
return JsonSerializer.Deserialize<Dictionary<string, object>>(jsonRaw, GrpcTypeHelper.SerializerOptions) ?? [];
var jsonRaw = JsonSerializer.Serialize(input, GrpcTypeHelper.SerializerOptions);
return JsonSerializer.Deserialize<Dictionary<string, object>>(jsonRaw, GrpcTypeHelper.SerializerOptions);
}
}