请实现一个算法,将上述json格式的数据填充到下面指定类的实例中
Public Class People{
Public String FirstName;
Public String LastName;
Public String Email;
} ------解决方案-------------------- mark ------解决方案--------------------
string s = @"{""people"":[
{""firstName"":""Brett"",""lastName"":""Mclaughlin"",""email"":""aaa""},
{""firstName"":""Jhon"",""lastName"":""Hunter"",""email"":""bbb""},
{""firstName"":""Jason"",""lastName"":""Harold"",""email"":""ccc""},]}";
MatchCollection matches = Regex.Matches(s, @"(?is)(?<={""people"":\[.*?){""firstName"":""(?<firstName>[^,]+)"",""lastName"":""(?<lastName>[^,]+)"",""email"":""(?<email>[^,]+)""},(?=.*?\]})");
List<People> peopleList = new List<People>();
foreach (Match match in matches)
{
People people = new People();
people.FirstName = match.Groups["firstName"].Value;
people.LastName = match.Groups["lastName"].Value;
people.Email = match.Groups["email"].Value;
peopleList.Add(people);
}
foreach (People people in peopleList)
Response.Write(string.Format("FirstName:{0}----LastName:{1}----Email:{2}<br/>", people.FirstName, people.LastName, people.Email));