{ "name": "", "address": { "street": "", "city": "", "province": "", "postalCode": "", "country": "" }, "phoneDay": "", "phoneCell": "", "businessName": "", "website": "", "email": "" }
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; } }
<.> 1. Web Essentials Extension of Visual Studio:
Click "Edit" -& GT; "Special Paste" -& GT; "Paste JSON as a class".
Download free executable files and run it from the command line.
Upload your JSON or provide its URL.
Similar to App.quickType.io, there is a user -friendly interface.
<.> 5. jsonutils:. Paste your JSON to the left field.
Attribute processing: app.quicktype.io to process dictionary and invalid C#attribute name.
The above is the detailed content of How Can I Automatically Generate C# Classes from JSON Strings?. For more information, please follow other related articles on the PHP Chinese website!