I had incorrectly resolved the JsonIgnore reference.
Note that this attribute exists in more than one namespace:
- System.Text.Json.Serialization
- Newtonsoft.Json
I had resolved this in VS to System.Text.Json.Serialization.JsonIgnore – however I was using the Newtonsoft library for my actual Serialise/Deserialise – and hence the attribute was ignored.
Changing the reference to Newtonsoft.Json.JsonIgnore resolved.