string str = textBox1.Text;
str.Replace("\\", "");
string strerrror;
try
{
JObject studentsJson = JObject.Parse(str);
string cellresult = studentsJson["resultCode"].ToString();
string cellresult1 = studentsJson["resultMsg"].ToString();
string cellresult2 = studentsJson["count"].ToString();
string cellresult3 = studentsJson["extend"].ToString();
string cellresult4 = studentsJson["data"]["printInfo"].ToString();
JObject studentsJson2 = JObject.Parse(cellresult4);
int nsize = studentsJson2["printDatas"].Count();
string cellresult5 = studentsJson2["printDatas"].ToString();
string cellresult6 = studentsJson2["printDatas"][0].ToString();
string cellresult7 = studentsJson2["printDatas"][0]["printTableDatas"].ToString();
int nsize2 = studentsJson2["printDatas"][0]["printTableDatas"][0].Count();
string cellresult8 = studentsJson2["printDatas"][0]["printTableDatas"][0]["lb1"].ToString();
}
catch(Exception ex)
{
strerrror = ex.ToString();
}
finally
{
}
解析一下格式
{
“resultCode”: “0000”,
“resultMsg”: null,
“count”: 0,
“extend”: {},
“data”: {
“printInfo”: “{“tempUpdateDate”:1692773967000,“tempData”:“PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxtb2RlbCBjaGFyU2V0PSJ1dGYtOCIgdGFibGVIZWFkRml4PSIwIiBiZ0NvbG9yPSIiIGJnSW1hZ2U9IiIgZ3JhZGVTaG93PSIxIiBncbGljPSJmYWxzZSIgZm9udEVkaXQ9ImZhbHNlIiByb3RhdGU9IjAiPiRQe3Byb2RXZWlnaHREWkJ9PC9jb2RlVGV4dD4NCiAgPC92YXJUZXh0Pg0KPC9tb2RlbD4NCg0K”,“panelTempCode”:“mojinquanqqqq”,“printServiceName”:“Microsoft Print to PDF”,“type”:“print”,“orgId”:“0002”,“printDatas”:[{“wpDateDZBWW”:“42”,“wpDateDZBYY”:“2023”,“custMtrlCode”:“123”,“allMac”:“null,null”,“prodModel”:“1”,“IDSerialNumber”:0,“tempExt4”:“123”,“moCode”:“lwl-zjh-019”,“labelId”:“0084”,“boxTypeUs”:“Trunkful”,“prodName”:“moaa”,“wpDateDD”:“17”,“mtrlColor”:“黑”,“prodExpireDate”:“20231116”,“moPQty”:2,“boxType”:“满箱”,“SNCreateDate”:“20231017”,“allLabelId”:“123,456”,“lbNum”:2,“prodCode”:“moaaa”,“minPackingQty”:“1”,“lbCount”:2,“69Code”:“123”,“wpDateYY”:“2023”,“wpDateMM”:“10”,“wpDateWW”:“42”,“isTrunkful”:“Y”,“printTableDatas”:[{“lb1”:“123”,“lb2”:“456”}]}]}”,
“cloudUrl”: “http://127.0.0.1:8080/cloudLabelClient/print/printByBs”
}
}