我有Rest Service API,合同是
[OperationContract]
[WebInvoke(
Method = "POST",
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "/CreateCustomActivity?token={authToken}"
)]
ProcessStatus CreateCustomActivity(string authToken, ProspectActivityCompound activity);
ProspectActivityCompound ,dataobject,具有数据类型的 ActivityFields 属性
Dictionary<string,string>
这是我的requestData
{
"RelatedProspectId": "2cd12345-1130-11e6-be13-06c7eb5c1234",
"ActivityEvent": 156,
"ActivityNote": "asdasdasd",
"ActivityDate": "/Date(1468394160000)/",
"ActivityDateTime": "2016-07-13 19:16:00",
"Score": 9,
"ActivityFields": {
"Custom_1": "1234",
"Custom_2": "asdf",
"Custom_3": "dfg",
"Custom_4": "qwe",
}
}
我知道我可以用它来获取字典中的数据。
"ActivityFields": [
{"Key":"Custom_1", "Value":"1234"},
{"Key":"Custom_2", "Value":"fgh"},
{"Key":"Custom_3", "Value":"wer"},
{"Key":"Custom_4", "Value":"sdfs"}
]
我希望 ActivityFields 作为键值对,但现在它将变为null。 JSON格式应该是相同的,所以任何人都可以给我一个方法来接收这个JSON作为键值对。