Skip to content
This repository has been archived by the owner on Dec 29, 2020. It is now read-only.

JSON Serialization

Trevor Pilley edited this page May 26, 2020 · 4 revisions

Due to the OData naming of certain properties, this library uses Json serialization attributes to specify the names (e.g. @odata.count).

The following serialisers (and versions) are currently catered or:

Newtonsoft.Json (Json.net)

  • The .NET Standard 2.0 build supports 10.0.1 (which is the minimum which supports .NET Standard 2.0) or later.
  • The .NET 4.5 build supports 6.0.4 (which is the minimum supported by ASP.NET WebAPI) or later.

Newtonsoft.Json.JsonSerializerSettings - expected configuration

ContractResolver = new CamelCasePropertyNamesContractResolver()
NullValueHandling = NullValueHandling.Ignore

System.Text.Json

  • The .NET Standard 2.0 build supports 4.6.0 or later.

System.Text.Json.JsonSerializerOptions - expected configuration

DictionaryKeyPolicy = JsonNamingPolicy.CamelCase
IgnoreNullValues = true
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
Clone this wiki locally