title: How to return a Json from a .Net Core Web API?
body: <p>This is a basic question.  I am new to ASP.Net Core so I created a .Net Core Web API project using the template in Visual Studio 2017 and I would like to know how to return a Json string from the Get() function.</p>
  
  <p>The Get() function provided.</p>
  
  <pre><code>    [HttpGet]
      public IEnumerable&lt;string&gt; Get()
      {
          return new string[] { "value1", "value2" };
      }
  </code></pre>
  
  <p>I would like to know how to change so it returns a Json string of int variable like the following.</p>
  
  <pre><code>    // GET: api/MOER
      [HttpGet]
      public &lt;&lt;some return type&gt;&gt; Get()
      {
          _MOER = 32;
  
          return &lt;&lt;return a Json result/string of _MOER&gt;&gt;;
      }
  </code></pre>
  
  <p>I am have seen the Nuget package Newtonsoft.Json where you serialize/deserialize but I am not sure if its applicable any more with .Net Core.</p>
  
  <p>I have also seen examples where they use JsonResult but when I try to use this approach, the compiler doesn't know what Json() is.</p>
  
  <pre><code>    [HttpGet]
      public JsonResult Get()
      {
          _MOER = 32;
  
          return Json(_MOER);
      }
  </code></pre>
  
  <p>Thank you for your help!</p>