RESTful WCF wrapping json response with method name

In my case, It was WebInvoke instead of WebGet and I was sending data in body. Because of that this solution didnt work for me. I have used the one below and it worked.

BodyStyle = WebMessageBodyStyle.RequestWrapped

So in post, the body should be wrapped but no need in response. Thanks for the questioner and his answer for giving a clue about this problem.


Ok, I have figured it out myself. The problem is the below line:

BodyStyle = WebMessageBodyStyle.Wrapped

When I changed this to:

BodyStyle = WebMessageBodyStyle.Bare

Everything works perfectly!

Thanks!

Tags:

Wcf

Json

Wcf Rest