一個C#類文件,如何自動生成考慮下面的JSON對象JSON對象字符串
form = {
"name": "",
"address": {
"street": "",
"city": "",
"province": "",
"postalCode": "",
"country": ""
},
"phoneDay": "",
"phoneCell": "",
"businessName": "",
"website": "",
"email": ""
}
什麼是一個工具自動生成下面的C#類?
public class ContactInfo
{
public string Name { get; set; }
public Address Address { get; set; }
public string PhoneDay { get; set; }
public string PhoneCell { get; set; }
public string BusinessName { get; set; }
public string Website { get; set; }
public string Email { get; set; }
}
public class Address
{
public string Street { get; set; }
public string City { get; set; }
public string Province { get; set; }
public string PostalCode { get; set; }
public string Country { get; set; }
}
我們已經看了這些問題:
Generate C# classes from JSON Schema詢問有關JSON架構可能是使用的道路的一種方法。
Benefits and drawbacks of generated C# classes for Json objects
http://json2csharp.com/ ??? – Habib
試試這個工具可能會有所幫助.. http://tools4geeks.com/json-to-Csharp-classes –