Convert json/xml data to corresponding data entities using VS2013

Source: Internet
Author: User

VS2013 provides the ability to convert JSON data to the corresponding data entity class, greatly improving the development efficiency, the specific conversion steps are as follows

1, first we need to convert the JSO data "copy", such as the following JSON data:

{
"Name": "JSON China",
"url": "Http://www.json.org.cn",
"Page": 88,
"Isnonprofit": true,
"Address":

Unknown macro: {"Street"}

,
"Links": [

Unknown macro: {"Name"}

,

Unknown macro: {"Name"}

,

Unknown macro: {"Name"}

]
}

2, create the entity class in the VS2013, opened just built this empty class, let's click on the menu bar "edit", select "Paste", click "Paste json as a class"

3. The above JSON data obtains the entity class as follows:

public class Rootobject
{
public string Name

Unknown macro: {get; set;}

public string URL

public int Page

Unknown macro: {get; set;}

public bool Isnonprofit

Public Address Address

Unknown macro: {get; set;}

Public link[] Links

}

public class Address
{
public String Street

Unknown macro: {get; set;}

public string City

public string Country

Unknown macro: {get; set;}

}

public class Link
{
public string Name

public string URL

Unknown macro: {get; set;}

}

4. XML to entity class, with JSON to entity class

Use VS2013 to convert json/xml data to corresponding data entities

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.