The data contract type 'DTO.AccountData' cannot be deserialized because the member 'properties' is not public. Making the member public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications.
And in my class all member variables are public
public class AccountData
{
public string mdn
{
get;
set;
}
.....
//other public varibales
.....
public Dictionary<string, string> properties
{
get;
set;
}
}
Update
I tried [DataContract] and [DataMember] attribute but doesn't work.
Unfortunately DataContractJsonSerializer
expects your json data as
{"properties":[{"Key":"Name","Value":"Valorie"},{"Key":"Month","Value":"May"},{"Key":"Year","Value":"2013"}]}
I think using Json.NET is a good idea to parse json
For more you can check this question Parse dictionary from json windows phone
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.