一个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 –