diff --git a/fruit-consumer-azurefunction/FruitMessage.cs b/fruit-consumer-azurefunction/FruitMessage.cs index a08ae80..537c65f 100644 --- a/fruit-consumer-azurefunction/FruitMessage.cs +++ b/fruit-consumer-azurefunction/FruitMessage.cs @@ -12,7 +12,7 @@ namespace Fruit.Consumer.AzureFunction { - public class FruitMessage : ISerializer + public class FruitMessage : ISerializer, IDeserializer { public DateTime? now { get; set; } public Fruit? fruit { get; set; } @@ -41,6 +41,11 @@ public byte[] Serialize(FruitMessage data, SerializationContext context) return ms.ToArray(); } } + + public FruitMessage Deserialize(ReadOnlySpan data, bool isNull, SerializationContext context) + { + return JsonConvert.DeserializeObject(Encoding.UTF8.GetString(data)); + } } public class LowercaseContractResolver : DefaultContractResolver {