The string obtained through packet capture is shown in jsonstring. If you are familiar with deserialization, you can provide the following types:
String jsonstring = @"{
"" Black "": [],
"" White "": [],
"" Contact "":[
{
"" Pinyin "":"""",
"" Nickname "": "" R "",
"" ID "": 575056787,
"" Email ":" "codemo@126.com ""
},
{
"" Pinyin "":"""",
"" Nickname "": "R6 "",
"" ID "": 575074340,
"" Email ":" "codemo@163.com ""
},
{
"" Pinyin "":"""",
"" Nickname "": "Yi "",
"" ID "": 574975530,
"" Email ":" "codemo@qq.com ""
},
{
"" Pinyin "":"""",
"" Nickname "": "" Swallow "",
"" ID "": 585384353,
"" Email ":" "codemo22@163.com ""
}
],
"" Group ": [],
"" Recent "": []
}";
# region address book
string rg_count = "Contact \": [[] (? .*?) [] ";
string [] K = emailhelp. getregvalue (jsonstring, rg_count, "Count");
string [] nickname = emailhelp. getregvalue (K [0], "nickname \":(? .*?) [,] "," Nickname ");
string [] email = emailhelp. getregvalue (K [0]," email \":(? .*?) [}] "," Email ");
string Path = string. Format (@" C: \ mail \ "+" codemo@sohu.com ");
If (! Directory. exists (PATH)
{< br> directory. createdirectory (PATH);
}< br> streamwriter Sw = new streamwriter (path + '\' + "sohucontacts.csv ");
// column name
SW. writeline ("nickname, email account");
// traverse datatable to export data
for (INT I = 0; I {< br> stringbuilder sbtext = new stringbuilder ();
sbtext. append (nickname [I] + ',' + email [I]);
// write a row of the datatable
SW. writeline (sbtext. tostring ();
}< br> SW. flush ();
SW. close ();
# endregion