Cock Silk skills--turn Json (Newtonsoft.Json.dll)

Source: Internet
Author: User

Mom doesn't have to worry about me turning json anymore!!

Very simple, nothing to explain, eh!

public class showtablepage<t> where T:class, new ()    {public        int total {get; set;}        Public list<t> rows {get; set;}    }    public class Showtablepage    {public        int total {get; set;}        Public DataTable rows {get; set;}    }    public class Showcombobox    {public        int id {get; set;}        public string text {get; set;}        public string Group {get; set;}        public bool selected {get; set;}        Public list<showcombobox> Children {get; set;}    }    public class resultmessage<t>    {public        resultmessage ()        {        } public        int Code {get; set;} Public        T MSG {get; set;}    }

  

1 protected voidPage_Load (Objectsender, EventArgs e)2         {3             if(!IsPostBack)4             {5Tojsongetdata TJGD =NewTojsongetdata ();6DataTable dt =TJGD. GetData1 ();7Showtablepage STP =Newshowtablepage {total = dt. Rows.Count, rows =DT};8                 varobj =(Newtonsoft.Json.Linq.JObject) Newtonsoft.Json.Linq.JToken.FromObject (STP);9                 stringJSON =obj. ToString ();Ten  One  AList<tojsonentity> listEn =TJGD. GetData2 (); -Showtablepage<tojsonentity> STP2 =Newshowtablepage<tojsonentity> {total = listen.count, rows =ListEn}; -obj =(Newtonsoft.Json.Linq.JObject) Newtonsoft.Json.Linq.JToken.FromObject (STP2); theJSON =obj. ToString (); -  - Response.Write (JSON); -             } +}
View Code

Download: json.dll.7z

Cock Silk skills--turn Json (Newtonsoft.Json.dll)

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.