title: How to respond via an JsonResult from Asp.Net Core middleware?
body: <p>I would like to respond via a <code>JsonResult</code> from a piece of Asp.Net Core middleware but it's not obvious how to accomplish that.  I have googled around alot but with little success.  I can respond via a <code>JsonResult</code> from a global <code>IActionFilter</code> by setting the <code>ActionExecutedContext.Result</code> to the <code>JsonResult</code> and that's cool.  But in this case I want to effectively return a <code>JsonResult</code> from my middleware.  How can that be accomplished?</p>
  
  <p>I framed the question with regard to the <code>JsonResult</code> <code>IActionResult</code> but ideally the solution would work for using any <code>IActionResult</code> to write the response from the middleware. </p>