title: MVC .NET Core web API XML or JSON
body: <p>I would like to create a web application that returns data in the form of XML or JSON, how do I go about doing this? </p>
  
  <p>The model:</p>
  
  <pre><code>namespace ReturningJSONandXML.Models
  {
      public class SomeImportantInformation
      {
          public int ID { get; set; }
          public string Information { get; set; }
      }
  }
  </code></pre>
  
  <p>The controller:</p>
  
  <pre><code>namespace ReturningJSONandXML.Controllers
  {
      public class GetInfoController : Controller
      {
          // GET: /&lt;controller&gt;/
          public List&lt;SomeImportantInformation&gt; Get()
          {
              List&lt;SomeImportantInformation&gt; ImportantInfo = new List&lt;SomeImportantInformation&gt;();
              ImportantInfo.Add(new SomeImportantInformation { ID = 0, Information = "Awesome info" });
              ImportantInfo.Add(new SomeImportantInformation { ID = 1, Information = "Some other interesting info" });
              return ImportantInfo;
          }
      }
  }
  </code></pre>
  
  <p>I would like to return an XML and JSON file...</p>
  
  <p>What are the best practice's I should be using here?</p>