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