请帮忙看看这JSON怎么解析?
代码如下:
string sample = "{putinBillNo:"MRK13070001", Details1:["putin_line_id:00001","pick_date:2013-09-11", "pick_place:广运码头"],Details2:["putin_line_id:00001","pick_date:2013-09-11"]}";
JObject jo=(JObject)JsonConvert.DeserializeObject(sample );
string sample = "{"putinBillNo":"MRK13070001", "Details1":["putin_line_id:00001","pick_date:2013-09-11", "pick_place:广运码头"],"Details2":["putin_line_id:00001","pick_date:2013-09-11"]}";
JObject jo = FromJson<JObject>(sample);
public class JObject
{
public string putinBillNo;
public string[] Details1, Details2;
}
public static T FromJson<T>(string json)
{
MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(json));
DataContractJsonSerializer j = new DataContractJsonSerializer(typeof(T));
return (T)j.ReadObject(ms);
}