on-internet
← Community

Set charset different from UTF-8 in JSON Response

Stack Overflow ·

I have this get request in my controller in ASP.NET Core project [HttpGet] [Route("api/controller/getlastresult/{id}")] public IActionResult GetLatestResultForController(string id) { Response.ContentType = "application/json"; var list = _dbAccessLayer.GetAllVoteResults(); var appropriateResults = list.Where(item => item.DeviceId.Equals(id) && item.Status == "Finished") .OrderBy(item => item.TimeStarted); if (appropriateResults.Any()) return Ok(Json(appropriateResults.Last().Result)); return BadRequest(); } It works fine, but in the headers there is Content-Type: application/json; charset=utf-8

Comments

Sign in or sign up to comment and upvote.

No comments yet.