Asp.net Json serialization and asp. netjson serialization

Source: Internet
Author: User

Asp.net Json serialization and asp. netjson serialization

Json is widely used in project development as a data transmission format and standard. So how to generate data in JSON format becomes the first problem we need to solve here we use. net.

First, get data

Public bannerImg (string imageurl, string linkurl)

{

ImageUrl = imageurl;

LinkUrl = linkurl;

}

Public string imageUrl {get; set ;}

Public string linkUrl {get; set ;}

}

Public class bannerImgList

{

Public List <bannerImg> GetProducts {get; set ;}

}

Usage

Dictionary <string, string> d = Bannner. getBanners ();

String localURL = "http://www.roubaowl. com7/Images /";

List <bannerImg> banner = new List <bannerImg> ()

{

New bannerImg (localURL + "1.png"," http://www.baidu.com "),

New bannerImg (localURL + "2.png"," http://www.baidu.com "),

New bannerImg (localURL + "3.png"," http://www.baidu.com ")

};

BannerImgList bannerList = new bannerImgList ();

BannerList. GetProducts = banner;

Response. Write (new JavaScriptSerializer (). Serialize (bannerList ));

// Wait for future check and make it easier for others.

Me: renhanlinbsl@163.com

13:116

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.