首先创建一个代表您的json数据的类。
public class MyFlightDto{ public string err_pre { get; set; } public string org { get; set; } public string flight_date { get; set; } // Fill the missing properties for your data}使用Newtonsoft JSON序列
化程序将json字符串反
序列化 为其对应的类对象。
var jsonInput = "{ org:'myOrg',des:'hello'}"; MyFlightDto flight = Newtonsoft.Json.JsonConvert.DeserializeObject<MyFlightDto>(jsonInput);或
JavascriptSerializer用于将其转换为类( 不建议使用,因为newtonsoft json序列化器似乎表现更好 )。
string jsonInput="have your valid json input here"; //JavascriptSerializer jsonSerializer = new JavascriptSerializer();Customer objCustomer = jsonSerializer.Deserialize<Customer >(jsonInput)
假设您要将其转换为类
Customer的实例。您的课程应类似于
JSON结构(属性)



