Return "raw" json in ASP.NET Core 2.0 Web Api
In your action, replace Ok()
with the Content()
method, which lets you set the content (raw content), content type, and status code of your response: https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.contentresult?view=aspnetcore-2.0
And of course a few minutes after posting the question I stumble upon a solution :)
Just return Content
with the content type application/json
...
return Content("{ \"name\":\"John\", \"age\":31, \"city\":\"New York\" }", "application/json");