From IT Skills
Revision as of 16:06, 12 August 2019 by Waiter (talk | contribs) (marking properties)
Jump to: navigation, search

How deserialize JSON[edit | edit source]

in dotNet[edit | edit source]

  • from System.Runtime.Serialization.dll by JsonReaderWriterFactory or DataContractJsonSerializer (faster than JavaScriptSerializer)
  • from System.Web.Extensions.dll by JavaScriptSerializer
  • from System.Web.Helpers.dll by Json.Decode
  • Windows.Data.Json for Win 8+
  • Newtonsoft Json.NET and Json.Linq or Path
  • simple Regex

inherited classes deserialization problem[edit | edit source]

DataContractJsonSerializer cannot deserialize complex objects, and __type is not managed.

XmlSerializer cannot help with complex objects too, only DataContractSerializer is needed.

marking properties[edit | edit source]

As of .NET 3.0, you can use DataContract instead of Serializable. With the DataContract though, you will need to either "opt-in" by marking the serializable fields with the DataMember attribute; or "opt-out" using the IgnoreDataMember... opt-out by default will only serialize public members, while opt-in will only serialize the marked members (regardless of protection level)

Wcf is synchronized by Typewriter

Newtonsoft.Json uses JsonProperty, JsonIgnore attributes.

in TypeScript[edit | edit source]