A sample way to convert json to object.
Hi, I just create a sample for you. And it works under a sample test.
Don`t remember to add
using Newtonsoft.Json;
public class JsonObjects { public authObject authObject; public billObj billObj; } public class authObject { public string userName; public string password; public string baladyCode; public string amanaCode; } public class billObj { public string billNumber; public string billCreationDate; public List<billDetails> billDetails; //public billDetail[] billDetails; } public class billDetails { public int depId; public int billValue; } string json = @"{ authObject:{ userName:7070, password:123, baladyCode:07, amanaCode:061 }, billObj:{ billNumber:'0611138000302', billCreationDate:'07-01-1438', billDetails: [{depId:11006,billValue:1}] } }"; public Form1() { InitializeComponent(); JsonObjects objs = JsonConvert.DeserializeObject<JsonObjects>(json); }
Love it, and you live without it