2

考虑遵循以 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"}]
4

0 回答 0