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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -