In the project, the foreground data is the JSON string, because there is no suitable entity to these fields, all in the simplest way: intercept the string.
The foreground JSON string is:
string S1 = "[{\ id\": \ "99d2a341-ea2e-4f04-b4f4-623153d64336\", \ "name\": \ "Harry \", \ "totalscores\": 80,\ "productivity \": \ "B\", \ "Professional ethics": \ "B\", "business capability": \ "a\", "link self-discipline": "B\", "Work performance \": \ "b\"},{\ "id\": \ "728f72ac-473b-4bde-bf83-7ed93d3fd9e6\", \ "name\": \ "Dick \", \ "totalscores\": 80,\ "work efficiency \": \ "B\", "Professional Ethics": \ "B\", "Business capability \": \ "a\", "link self-discipline \": \ "B\", "Performance \": \ "B\"} , {\ "id\": \ "29c80443-d0ac-414c-91b5-acd5e69e28f2\", "name\": \ "Liu Qi", "totalscores\": 80,\ "work efficiency": \ "B\", "Professional ethics": \ "B\", \ "business capability \": \ "a\", "link self-discipline": \ "B\", "Work performance \": \ "B\"}] ";
You can see in fact in Microsoft in the "\" as double quotes, the idea is this:
1, remove "\" "
Code implementation:
Strings11=s1. Replace ("\", "");
2, remove "[]"
Code implementation:
String S22 =s11. Replace ("[", "");
String S33 =s22. Replace ("]", "");
This is the time we get the S33 is this:
S33= "{id:99d2a341-ea2e-4f04-b4f4-623153d64336,name: Harry, totalscores:80, work efficiency: B, Professional ethics: B, Business ability: A, link self-discipline: B, work score: B},{id : 728f72ac-473b-4bde-bf83-7ed93d3fd9e6,name: Dick, totalscores:80, work efficiency: B, Professional ethics: B, Business ability: A, link self-discipline: B, work score: B},{id : 29c80443-d0ac-414c-91b5-acd5e69e28f2,name: Liu Qi, totalscores:80, work efficiency: B, Professional ethics: B, Business ability: A, link self-discipline: B, performance: B} "
3, replace "},{" to "}", remove null value
Code implementation:
String S44 =s33. Replace ("},{", "}");
S44= "{id:99d2a341-ea2e-4f04-b4f4-623153d64336,name: Harry, totalscores:80, work efficiency: B, Professional ethics: B, Business ability: A, link self-discipline: B, work score: B}id : 728f72ac-473b-4bde-bf83-7ed93d3fd9e6,name: Dick, totalscores:80, work efficiency: B, Professional ethics: B, Business ability: A, link self-discipline: B, work score: B}id : 29c80443-d0ac-414c-91b5-acd5e69e28f2,name: Liu Qi, totalscores:80, work efficiency: B, Professional ethics: B, Business ability: A, link self-discipline: B, performance: B} "
String[] s55s =s44. Split (new char[] {'} ', ' {'}, stringsplitoptions.removeemptyentries);
S55s is the "Id:99d2a341-ea2e-4f04-b4f4-623153d64336,name: Harry, ..." to put the resulting results in the dictionary:
<span style= "FONT-SIZE:18PX;" > for (int i = 0; i < updatededit.length i++) {//string[] Detailevaluationinfo = updatededit[ I].
Split (', ');
String Pat = @ "(? <key>[^,:\s]*):(<value>[^,:\s]*)"; A group of data is taken out//for (int j = 0; J < Detailevaluationinfo. Length;
J + +) {MatchCollection matches = regex.matches (Updatededit[i], Pat);
dictionary<string, string> dict = new dictionary<string, string> (); foreach (Match m in matches) {if dict. ContainsKey (m.groups["key"). Value) continue;//can not repeat Ah Dict. ADD (m.groups["key"). Value, m.groups["value"].
Value); }}</span>
This allows you to intercept the JSON string.