Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 更改在ServiceContract中序列化IDictionary的方式_C#_.net_Json_Servicecontract - Fatal编程技术网

C# 更改在ServiceContract中序列化IDictionary的方式

C# 更改在ServiceContract中序列化IDictionary的方式,c#,.net,json,servicecontract,C#,.net,Json,Servicecontract,但实际响应的格式如下所示: {"Name":"name","Attributes":{"foo":"bar"}} 我喜欢第一种变体。如何配置或控制序列化以实现此目的 {"Name":"name","Attributes":{"foo":"bar"}} {"Name":"name","Attributes":[{"Key":"foo","Value":"bar"}]}

但实际响应的格式如下所示:

{"Name":"name","Attributes":{"foo":"bar"}}
我喜欢第一种变体。如何配置或控制序列化以实现此目的

{"Name":"name","Attributes":{"foo":"bar"}}
{"Name":"name","Attributes":[{"Key":"foo","Value":"bar"}]}