WCF - POST JSON字典没有键/值文本 [英] WCF - POST JSON Dictionary without Key/Value Text
本文介绍了WCF - POST JSON字典没有键/值文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个WCF终结就是喜欢这样的:
I have a WCF endpoint that is like such:
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json, UriTemplate = "")]
Stream DoWork(Dictionary<string, string> items);
为了通过什么我的服务,我要组织我的JSON像这样的:
In order to pass anything to my service, I have to structure my JSON like such:
{"items":[{"Key":"random1","Value":"value1"}, {"Key":"random2","Value":"value2"}]}
我真正想要的样子是这样的:
What I actually want it to look like is this:
{"items":{"random1":"value1","random2":"value2"}}
有没有办法做到这一点?
Is there any way to accomplish this?
推荐答案
您将不得不编写您自己的包装。
You will have to write your own wrapper.
这篇关于WCF - POST JSON字典没有键/值文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文