I have a json stored in database in a ntext field, I want to return that in a svc (c#) webservice , webservice is get and response type is string such as below :
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "gcwbcc/{cityCode}/{key}")]
but in result i get extra double qutation also all double qutions in json converts to \" then I have two problems one is extra double qutation , and second is convertint " to \" in result.
I solve it by changing return type of web method to stream and with writing this simple line of code:
byte[] resultBytes = Encoding.UTF8.GetBytes(result); WebOperationContext.Current.OutgoingResponse.ContentType = "application/json; charset=utf-8"; return new MemoryStream(resultBytes);
refrence: Returning raw json (string) in wcf but here is original guide https://blogs.msdn.microsoft.com/carlosfigueira/2008/04/17/wcf-raw-programming-model-web/