How to serialize a large JSON object directly to HttpResponseMessage stream?
Is there any way to stream a large JSON object directly to the HttpResponseMessage stream? Here is my existing code: Dictionary<string,string> hugeObject = new Dictionary<string,string>(); // fill with 100,000 key/values. Each string is 32 chars. HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); response.Content = new StringContent( content: JsonConvert.SerializeObject(hugeObject), encoding: Encoding.UTF8, mediaType: "application/json"); Which works fine for smaller objects. However, the process of calling JsonConvert.SerializeObject() to convert the object into a