0

C# noob here.

I'm doing a simple wcf service RestAPI, so far so good...but my json string response isn't coming out the way i wanted.

Actual response: {"GetInfoResult":{"Name": "John"}}

Desired response: {"Name": "John"}

how do I remove GetInfoResult field?

Thanks

1 Answer 1

1

You should be able to just set the BodyStyle to WebMessageBodyStyle.Bare on your WebGet annotation, the default is WebMessageBodyStyle.Wrapped that adds the wrapper you don't want;

[WebGet(BodyStyle = WebMessageBodyStyle.Bare)]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.