I have RESTful API that returns some large JSON files. In some instance, the returned string could become more than 1GB. When that happens, I only get some part of the content, meaning, I'm returning an array of objects, but only the first item is returned. Is there a way to remove this limitation? Here's my code (which is pretty simple).
[HttpPost]
[Route("rest/result")]
public IActionResult GetResult(string requestId)
{
var item = _service.GetItem(requestId);
return item?.Result == null ? NotFound() : Ok(item.Result);
}
Edit:
This seems to return the 1GB JSON string but I'm not sure it's exactly the same data:
[HttpPost]
[Route("rest/result")]
public IActionResult GetResult(string requestId)
{
var item = _service.GetItem(requestId);
if (item?.Result == null)
{
return NotFound();
}
var json = JsonSerializer.Serialize(item.Result);
return Content(json, "application/json");
}