Parse JSON in Asp.net

Source: Internet
Author: User
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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.