I'm having a problem getting multiple Json objects using HttpResponseMessage. How can this be acheived without wrapping the string as Json?
This is the code that I have tried so far...
private HttpResponseMessage SetToJson(string jsonString)
{
string str = "ABC";
HttpRequestMessage Request = new HttpRequestMessage();
Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
Request.Content = new StringContent(jsonString, Encoding.UTF8, "application/json");
return Request.CreateResponse(HttpStatusCode.OK, new { jsonString, str }, JsonMediaTypeFormatter.DefaultMediaType);
}
It works fine, but it appends \r\n" by itself. How can this be fixed? Is there any other alternative?
This is the returned response by the above code
{"jsonString":["{\r\n \"resourceType\": \"Patient\",\r\n \"entry\": []\r\n}","ABC"]}