c# - Why won't JsonConvert deserialize this object? -


i have json:

{       "cutcenterid":1,     "name":"demo cut center",     "description":"test",     "isavailable":true,     "e2customerid":"110000",     "numberofmachines":2,     "machines":[] } 

i have following poco:

public class cutcenter {     int cutcenterid { get; set; }     string name { get; set; }     string description { get; set; }     bool isavailable { get; set; }     string e2customerid { get; set; }     int numberofmachines { get; set; } } 

i try following line of code json set above json , _cutcenter member variable.

_cutcenter = jsonconvert.deserializeobject<cutcenter>(json); 

after _cutcenter set defaults. why? doing wrong?

your members private. try this.

public class cutcenter {     public int cutcenterid { get; set; }     public string name { get; set; }     public string description { get; set; }     public bool isavailable { get; set; }     public string e2customerid { get; set; }     public int numberofmachines { get; set; } } 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -