I am experimenting with JavaScriptSerializer to deserialize some JSON in C#, and have a couple of questions regarding the use of DataMember.
I want my DataContract class to have a property called "Parts" that maps to a JSON object "rings". If I set the DataMember Name="rings" and name the property "Rings" everything works as expected. However, if I name the property "Parts" (leaving the DataMember Name="rings"). Parts is always null.
// this is always null [DataMember(Name = "rings")] public ArrayList Parts { get; set; } // this works fine [DataMember(Name = "rings")] public ArrayList Rings { get; set; }
Upon deserialization, is it possible to map multiple json objects to a single property. For example, the input json string may not contain "rings", but rather "point" or "line". Can I map all three types to the Parts property?