1

I have the following object:

[DataContract]
public class A
{
   [DataMember]
   Dictionary<string,string> B {get; set;}
} 

With the default serialization using DataContractJsonSerializer I get the following JSON

{ B : [{"Key":"Rable","Value":"RableRable"}] }

But what I want to get is the following

{ B : [ { "Rable" : "RableRable" } ] }

being the "Rable" the key of an Dictionary Entry and the "RableRable" the value.

cuongle
  • 74,024
  • 28
  • 151
  • 206
IgrCndd
  • 53
  • 4
  • This question might help: http://stackoverflow.com/questions/4861138/c-sharp-json-serialization-of-dictionary-into-keyvalue-instead-of-keyk – robyaw Sep 14 '12 at 09:27
  • Thank you robyaw, your comment solved my problem – IgrCndd Sep 14 '12 at 09:40

0 Answers0