namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string jsonString = "[{\"downList\": [],\"line\": {\"Id\": -1,\"Name\": \"admin\",\"icCard\": \"1\"},\"upList\": [{\"endTime\": \"18:10\",\"startTime\": \"06:40\",\"sId\": 385,\"sType\": \"38\"},{\"endTime\": \"18:10\",\"startTime\": \"06:40\",\"sId\": 1036,\"sType\": \"38\"}]},{\"downList\": [],\"line\": {\"Id\": -1,\"Name\": \"admin\",\"icCard\": \"1\"},\"upList\": [{\"endTime\": \"18:10\",\"startTime\": \"06:40\",\"sId\": 385,\"sType\": \"38\"},{\"endTime\": \"18:10\",\"startTime\": \"06:40\",\"sId\": 1036,\"sType\": \"38\"}]}]";
Data[] datas = JsonConvert.DeserializeObject<Data[]>(jsonString);
foreach (Data data in datas)
{
downList[] downList = data.downList;
line line = data.line;
upList[] upLists = data.upList;
//输出
Console.WriteLine(string.Join(",", line.Id, line.Name, line.icCard));
foreach (upList upList in upLists)
{
Console.WriteLine(string.Join(",", upList.endTime, upList.startTime, upList.sId, upList.sType));
}
Console.WriteLine("-----------------------------------------------");
}
}
}
public class Data
{
public downList[] downList { get; set; }
public line line { get; set; }
public upList[] upList { get; set; }
}
public class downList
{
}
public class line
{
public int Id { get; set; }
public string Name { get; set; }
public string icCard { get; set; }
}
public class upList
{
public string endTime { get; set; }
public string startTime { get; set; }
public int sId { get; set; }
public string sType { get; set; }
}
}