{\ "log_id " : 7616486206799412622, \ "results " : [{\ "location " : {\ "height " : 543, \ "left " : 1312, \ "top " : 644, \ "width " : 669}, \ "name " : \ "1234 ", \ "score " : 1}]} \ n}
"
{\ "log_id " : 1587313827561704838, \ "results " : []} \ n}
"
If the second return value was submitted to the wrong
Code:
JavaScriptSerializer js=new JavaScriptSerializer ();//instantiate a class can be serialized data
ToJsonMy3 list=js. Deserialize
List
String name=named orderdetail [0]. Name;
String score=named orderdetail [0]. Score;
Public struct ToJsonMy3
{
Public string log_id {get; The set; }
Public List
//public results results;
}
Public struct the results
{
Public string name {get; The set; }
Public string score {get; The set; }
Public List
}
Public struct location
{
Public string top {get; The set; }
Public string left the {get; The set; }
Public string width {get; The set; }
Public string height {get; The set; }
}
Thank you. What should I do
CodePudding user response:
Do you want to see your json string really contains \ n, and there should be a comma between the second and first article[{" log_id: "7616486206799412622," results ": [{" location" : {" height ": 543, the" left ": 1312," top ": 644, the" width ": 669}," name ":" 1234 ", "score" : 1}]},
{" log_id: "7616486206799412622," results ": [{" location" : {" height ": 543, the" left ": 1312," top ": 644, the" width ": 669}," name ":" 1234 ", "score" : 1}]}]
CodePudding user response:
Wrong, it is two kinds of results returned1: {" log_id: "1594288546244956330," results ": []}
2: {" log_id: "30078127253539397," results ": [{" location" : {" height ": 543, the" left ": 1312," top ": 644, the" width ": 669}," name ":" cat ", "score" : 0.9970706701278687}]}
Return parameter
Whether a field will choose type description
Log_id was the only log id number for problem positioning
Results no array (object) to identify the result array
+ name no string classification name
Confidence + score no number
+ location no
+ + left no number detected target distance of the body area to the border of the image left
+ + top n number of detected target distance of the body area to the border of the picture
+ + width or the width of the number of detected target the body area
+ + height or number of detected target the height of the body area
Results the correct empty words
CodePudding user response:
Deserialization obviously not an errorBut the second actually there is no data
List
String name=named orderdetail [0]. Name;
String score=named orderdetail [0]. Score;
This named orderdetail no natural element cannot be named orderdetail [0]
CodePudding user response:
No problem,
CodePudding user response:
String name=named orderdetail [0]. Name;String score=named orderdetail [0]. Score;
This named orderdetail no natural element cannot be named orderdetail [0]
How to deal with it? Judgement more? There is no element NAME=""
CodePudding user response:
The parameters of the null value with newtonsoft a ignoredCodePudding user response: