When decorating your enum with:
[JsonConverter(typeof(StringEnumConverter))]
public EventEntity Entity { get; set; }
And serializing it with
JsonConvert.SerializeObject(myEvent)
You may notice that the enum is not serialized as a string but as the default integer.
Simple one really but had me scratching my head for 20 mins or so...
When using the JsonConverter atribute, the first intellisense import is:
using System.Text.Json.Serialization
But you should instead use:
using Newtonsoft.Json;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With