using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace laserPTZ.AI { public class ResponseData { private Msg[] msg; public Msg[] Msg { get { return msg; } set { msg = value; } } public static ResponseData convertToObject(String str) { ResponseData responseData = JsonConvert.DeserializeObject<ResponseData>(str); return responseData; } } public class Msg { private string class_id; private string confidence; private float[] left_top; private float[] right_bottom; public string Class_id { get { return class_id; } set { class_id = value; } } public string Confidence { get { return confidence; } set { confidence = value; } } public float[] Left_top { get { return left_top; } set { left_top = value; } } public float[] Right_bottom { get { return right_bottom; } set { right_bottom = value; } } public static void convertToObject() { string str = "[{class_id: 68,confidence: 0.66,left_top: [1194.00, 398.00],right_bottom: [1458.00, 617.00]}]"; Msg[] responseData = JsonConvert.DeserializeObject<Msg[]>(str); int a = 0; } } }