I have a WCF service. URL is: http://iphone.clickcelltest.com/EduLink.svc/GetLevel
Methods have following attribute:
[WebGet(ResponseFormat=WebMessageFormat.Json)]
I get Data from Database and then in Collection/List of classes.
I use Newtonsoft.Json DLL to convert the collection to json string. It does it very well but i need to send this to iPhone.
But, i get unnecessary escaping of quotes. I understand the reason why it is happening.
But, is there a way to avoid it
So, how can i change the current result:
"{\"Object\":[{\"LevelID\":4,\"LevelName\":\"Level A\"}]}"
To
{"Object":[{"LevelID":4,"LevelName":"Level A"}]}
Let me know if more clarity is required.
Thanks much in advance.
That looks like the result of returning a manually JSON-serialized string, which WCF is then serializing again. Rather than returning a string that you’ve built with Json.NET, make your service’s return value match the type of data you’re returning and return that data directly.
If you specifically need to use Json.NET for some reason, using an HttpHandler instead of WCF would allow you to respond at that lower level without WCF interfering.