@@ -76,7 +76,7 @@ public class SystemTextJsonObjectSerializer : IObjectSerializer
7676 string => JsonSerializer . Serialize ( value , SourceGenerationContext . Default . String ) ,
7777 ElementTheme => JsonSerializer . Serialize ( value , SourceGenerationContext . Default . ElementTheme ) ,
7878 DateTimeOffset => JsonSerializer . Serialize ( value , SourceGenerationContext . Default . DateTimeOffset ) ,
79- _ => default
79+ _ => JsonSerializer . Serialize ( value , typeof ( T ) , SourceGenerationContext . Default )
8080 } ;
8181
8282 public T Deserialize < T > ( [ StringSyntax ( StringSyntaxAttribute . Json ) ] string value )
@@ -87,8 +87,9 @@ public T Deserialize<T>([StringSyntax(StringSyntaxAttribute.Json)] string value)
8787 : type == typeof ( string ) ? Deserialize ( value , SourceGenerationContext . Default . String )
8888 : type == typeof ( ElementTheme ) ? Deserialize ( value , SourceGenerationContext . Default . ElementTheme )
8989 : type == typeof ( DateTimeOffset ) ? Deserialize ( value , SourceGenerationContext . Default . DateTimeOffset )
90- : default ;
91- static T Deserialize < TValue > ( [ StringSyntax ( StringSyntaxAttribute . Json ) ] string json , JsonTypeInfo < TValue > jsonTypeInfo ) => JsonSerializer . Deserialize ( json , jsonTypeInfo ) is T value ? value : default ;
90+ : JsonSerializer . Deserialize ( value , typeof ( T ) , SourceGenerationContext . Default ) is T result ? result : default ;
91+ static T Deserialize < TValue > ( [ StringSyntax ( StringSyntaxAttribute . Json ) ] string json , JsonTypeInfo < TValue > jsonTypeInfo ) =>
92+ JsonSerializer . Deserialize ( json , jsonTypeInfo ) is T value ? value : default ;
9293 }
9394 }
9495
0 commit comments