Using system. web. script. serialization; public class emergencyjson {// <summary> // Department // </Summary> Public String createunit {Get; set ;} /// <summary> /// department ID /// </Summary> Public String createdeptid {Get; set ;} /// <summary> /// filling time /// </Summary> Public String createdate {Get; set ;} /// <summary> /// event unit // </Summary> Public String happenunit {Get; set ;} /// <summary> /// department ID/// </Summary> Public int happendeptid {Get; set ;} /// <summary> /// occurrence time /// </Summary> Public String happendate {Get; set ;} /// <summary> /// important information system /// </Summary> Public String impinfosys {Get; set ;} /// <summary> /// Special Information System /// </Summary> Public String promoinfosys {Get; set ;} /// <summary> /// Container service time period start time /// </Summary> Public String stimestart {Get; set ;} /// <summary> /// end time of the cabinet service period /// </Summary> Public String stimeend {Get; set ;} /// <summary >/// start time of the non-cabinet service period /// </Summary> Public String nonstimestart {Get; set ;} /// <summary >/// end time of the non-cabinet service period /// </Summary> Public String nonstimeend {Get; set ;} /// <summary> /// event impact scope /// </Summary> Public String incidence {Get; set ;} /// <summary> /// event symptom and basic cause // </Summary> Public String reason {Get; set ;} /// <summary> /// processing result /// </Summary> Public String detail {Get; set ;} /// <summary> /// contact number of the Creator /// </Summary> Public String creatertel {Get; set ;} /// <summary> /// remarks /// </Summary> Public String remark {Get; set ;} /// <summary> /// creator /// </Summary> Public String creater {Get; Set ;}} // resolution class public class jsonhelper {public emergencyjson readjson (string jsonstr) {javascriptserializer JSS = new javascriptserializer (); emergencyjson userjson = JSS. deserialize <emergencyjson> (jsonstr); Return userjson ;}}
JSON format:
{'Createunit': 'test part', 'createdemotid': '000000', 'createdate': '2017-12-05 18:31:00. 000 ',
'Happenunit': 'dashboard ', 'happendemotid': '201312', 'happendate': '2017-12-04 18:56:00. 000 ',
'Infosys ': 'dddd', 'promoinfosys': 'ddd ', 'stimestart': '2017-12-04 18:57:00. 000 ',
'Stimeend': '2017-12-04 18:57:00. 000 ', 'nonstimestart': '2017-12-04 18:57:00. 000 ', 'nonstimeend': '2017-12-04 18:57:00. 000 ',
'Incidence ': '000000', 'reason': 'ffffff', 'detail ': 'fff', 'creatertel': 'dddfff', 'remark': 'dd ', 'creater': 'owiewow '}
Note: emergencyjson is the field name, And jsonhelper is the parsing unit.