How to pass instance property as parameter to JsonConverter?
I want to pass value of property Field1
as parameter to Newtonsoft.Json.JsonConverter
that’s applied on Data
property. I tried [JsonConverter(typeof(HardwareParamJsonConverter), Field1)]
, but obviously get CS0120: An object reference is required for the nonstatic field, method, or property 'Message.Field1'
error when I try to deserialize JsonConvert.DeserializeObject<Message>(msgJson);
. What can I do to achieve this?