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
Post a Comment