title: How to auto-generate a C# class file from a JSON string
body: <p>Given the following JSON object,</p>
  
  <pre><code>form = {
    "name": "",
    "address": {
      "street": "",
      "city": "",
      "province": "",
      "postalCode": "",
      "country": ""
    },
    "phoneDay": "",
    "phoneCell": "",
    "businessName": "",
    "website": "",
    "email": ""
  }
  </code></pre>
  
  <p>what is a tool to auto-generate the following C# class?</p>
  
  <pre><code>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; }
  }
  </code></pre>
  
  <p>We have already looked at these questions: </p>
  
  <p><a href="https://stackoverflow.com/questions/6358745/generate-c-sharp-classes-from-json-schema">Generate C# classes from JSON Schema</a> Is asking about JSON Schemas which may be an approach to use down the road.</p>
  
  <p><a href="https://stackoverflow.com/questions/9229237/benefits-and-drawbacks-of-generated-c-sharp-classes-for-json-objects">Benefits and drawbacks of generated C# classes for Json objects</a></p>