WCF JSON IDictionary序列化

时间:2013-10-31 16:09:14

标签: c# json wcf serialization dictionary

考虑遵循以JSON接收和返回数据的WCF方法。

public IDictionary<string, string> GetData(IDictionary<string, string> input)
{
    input.Add("newKey","newValue");
    input.Add("newKey2","newValue2");
    return input;
}

有没有办法通过和;以格式检索JSON:

[{"newKey":"newValue","newKey2":"newValue2"}]

而不是:

[{"Key":"newKey","Value":"newValue"},
{"Key":"newKey2","Value":"newValue2"}]

0 个答案:

没有答案