我有一个 json 字符串,我正在尝试为 EmployeeId、EmployeeName 和日期创建一个 foreach:
{"$id":"1","Employee":{"$id":"2","RelationshipManager":{"$id":"3","_owner":{"$ref":"2"},"_relationships":[[{"$id":"4","Calendarbookings":null,"Id":1,"MId":1,"Startdate":"2011-01-14T00:00:00","Enddate":"2011-01-14T00:00:00","StartTime":"1899-12-30T10:00:00","Endtime":"1899-12-30T16:00:00","EmployeeId":1,"DebtorId":0,"Subject":"Tidevand Odense","Description":null,"AllDay":0,"Wwwaddress":"","Mailaddress":"","IsTeam":1,"IsRessource":0,"RessourceType":0,"Participants":1,"Department":0,"IsRepeating":0,"TaskType":0,"Categorytype":0,"Price":495.0,"WaitinglistIsEnabled":1,"Deadline":"2011-02-01T00:00:00","DeadlineForCancellation":"1899-12-30T00:00:00","Ending":"2011-01-14T00:00:00","OnlineEnabled":1,"Revenueaccount":1502,"Maxbooking":20,"Employee":{"$ref":"2"}}]]},"Id":1,"SearchKey":"","EmployeeName":"Erik Steen Larsen","Address1":"","Address2":"","Zip":"","City":"","Phone":"","CashSuper":"0","ActiveInCalendar":"1","Startdate":"1899-12-30T00:00:00","Enddate":"1899-12-30T00:00:00","Mobile":"30125744","Description":null,"Events":[{"$ref":"4"}]},"ErrorCode":0,"Status":0,"StatusString":"Okay","Message":null,"ApiVersion":"1.0.0.8"}
怎么做???
_jsonContent = JsonConvert.DeserializeObject(JSONSTRING);
foreach (var item in _jsonContent.Employee)
{
littext.Text += item.EmployeeName;
littext.Text += item.Id;
}
谢谢