title: How can I serialise a ViewModel in to a JSON object
body: <p>I have a view model. That view model has an implementation. The implementation is a c# class. The c# class has properties and attributes. I would like to serialize the properties and attributes in to a JSON object. I don't need any of the data it's the validation details that I require in the JSON object. The following is my view model:</p>
  
  <pre><code>public class CreateProjectViewModel
  {
      public SelectList Categories;
      public SelectList Locations;
  
      public CreateProjectViewModel() { }
  
      public CreateProjectViewModel(SelectList categories, SelectList locations)
      {
          this.Categories = categories;
          this.Locations = locations; 
      }
  
      [Required(ErrorMessage = "You must provide a unique name for your project.")]
      [Display(Name = "Project name")]
      [MaxLength(128)]
      public string Name { get; set; }
  
      [Required(ErrorMessage = "Give a succinct description of the issues your project is designed to address")]
      [Display(Prompt = "E.g Reduce plastic waste and save our oceans!")]
      public string Description { get; set; }
  }
  </code></pre>