c# - deserializing Static properties using json.net? -
hi guys have json 1 below
{ "totals": { "tokentype": "string", "tokendenomination": "double", "count": "int" }, "idcode": "string", "key": "string" }
and c# code deserialize in object
internal class gettokenrootinfo { public static totals totals{ get; set;} public static string idcode{ get; set;} public static string key{ get; set;} }
when use jsonconvert.deserializeobject<gettokenrootinfo>(json);
nothing being set , every var null.
but if remove static types works.
can 1 tell me reason why static types not working when deserializing object?
if want deserialize static members on class, can explicitly mark them [jsonproperty]
attribute, , allow work:
internal class gettokenrootinfo { [jsonproperty("totals")] public static totals totals { get; set; } [jsonproperty("idcode")] public static string idcode { get; set; } [jsonproperty("key")] public static string key { get; set; } }
Comments
Post a Comment