Is there a way to pass a large JSON object directly to an HttpResponseMessage stream?
Here is my existing code:
Dictionary<string,string> hugeObject = new Dictionary<string,string>();
HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
response.Content = new StringContent(
content: JsonConvert.SerializeObject(hugeObject),
encoding: Encoding.UTF8,
mediaType: "application/json");
Which is great for small objects. However, the process of calling JsonConvert.SerializeObject () to convert an object to a string causes problematic outbreaks of memory for large objects.
I want to make the equivalent of what is described here for deserialization .
source
share