json - Parsing string to an Object C# -


i trying parse string object

here string;

string result = {"status":true,"statuscode":"ok","messagelist":[[1,1,"admin@....net","google inc","\/date(1469685360000)\/","seatle","another string"]]} 

here class;

[datacontract]     public class login     {         [datamember]         public bool status { get; set; }         [datamember]         public string statuscode { get; set; }         [datamember]         public string[] messagelist { get; set; }      } 

here code;

login asd = new javascriptserializer().deserialize<login>(result); 

i new in field, don't have idea how code it

the messagelist in json string not array of strings, array of arrays of strings. update messagelist property in class definition public string[][] messagelist { get; set; }

[datacontract] public class login {     [datamember]     public bool status { get; set; }     [datamember]     public string statuscode { get; set; }     [datamember]     public string[][] messagelist { get; set; } } 

now, de-serialization should work.

static void main(string[] args) {     string result = "{\"status\":true,\"statuscode\":\"ok\",\"messagelist\":[[1,1,\"admin@....net\",\"google inc\",\"\\/date(1469685360000)\\/\",\"seatle\",\"another string\"]]}";     login asd = new javascriptserializer().deserialize<login>(result);     console.readline(); } 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -