I have a json string, for example
{"timestamp":1362463455, "features" : {"one":true, "two":false}}
I want to deserialize it with DataContractJsonSerializer
to my class:
[DataContract]
public class MyClass
{
[DataMember(Name = "timestamp")]
public int Timestamp { get; set; }
[DataMember(Name = "features")]
public Dictionary<string, bool> Features { get; set; }
}
But I have a error in process "ArgumentException"
. I have a problems with deserialize Dictionary
, if deserialize only timestamp then I don't have errors. I thought is dictionary most suitable structure for this. But it don't work. I checked this answer on SO, but Dictionary<string, object>
don't work too.
Maybe because in example using:
DataContractJsonSerializerSettings settings =
new DataContractJsonSerializerSettings();
settings.UseSimpleDictionaryFormat = true;
But I can't use DataContractJsonSerializerSettings
in Windows Phone.
Sorry, if my question is double.
Thank advance.