title: Cant get ASP.NET MVC 6 Controller to return JSON
body: <p>I have an MVC 6 project in which i am using Fiddler to test out Web API. If i take the following controller action which uses EntityFramework 7 to return a List. Then the html will render fine.</p>
  
  <pre><code>[HttpGet("/")]
  public IActionResult Index()
  {
      var model = orderRepository.GetAll();
  
      return View(model);
  }
  </code></pre>
  
  <p>But when i try to return a Json response instead i get a 502 error.</p>
  
  <pre><code>[HttpGet("/")]
  public JsonResult Index()
  {
      var model = orderRepository.GetAll();
  
      return Json(model);
  }
  </code></pre>
  
  <p>Any Idea on why the object isnt serialized into json correctly?</p>