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