title: ASP.NET Core return JSON with status code
body: <p>I'm looking for the correct way to return JSON with a HTTP status code in my .NET Core Web API controller. I use to use it like this:</p>
  
  <pre><code>public IHttpActionResult GetResourceData()
  {
      return this.Content(HttpStatusCode.OK, new { response = "Hello"});
  }
  </code></pre>
  
  <p>This was in a 4.6 MVC application but now with .NET Core I don't seem to have this <code>IHttpActionResult</code> I have <code>ActionResult</code> and using like this:</p>
  
  <pre><code>public ActionResult IsAuthenticated()
  {
      return Ok(Json("123"));
  }
  </code></pre>
  
  <p>But the response from the server is weird, as in the image below:</p>
  
  <p><a href="https://i.stack.imgur.com/DpSlo.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DpSlo.png" alt="enter image description here"></a></p>
  
  <p>I just want the Web API controller to return JSON with a HTTP status code like I did in Web API 2.</p>