Class Extensions
Static class containing extension methods to configure Json.NET for Noda Time types.
Since 1.2.x
Availability netstandard2.0
Inherited Members
Namespace: NodaTime.Serialization.JsonNet
Assembly: NodaTime.Serialization.JsonNet.dll
Syntax
public static class Extensions
Methods
ConfigureForNodaTime(JsonSerializer, IDateTimeZoneProvider)
Configures Json.NET with everything required to properly serialize and deserialize NodaTime data types.
Since 1.2.x
Availability netstandard2.0
Declaration
public static JsonSerializer ConfigureForNodaTime(this JsonSerializer serializer, IDateTimeZoneProvider provider)
Parameters
Type | Name | Description |
---|---|---|
JsonSerializer | serializer | The existing serializer to add Noda Time converters to. |
IDateTimeZoneProvider | provider | The time zone provider to use when parsing time zones and zoned date/times. |
Returns
Type | Description |
---|---|
JsonSerializer | The original serializer value, for further chaining. |
ConfigureForNodaTime(JsonSerializer, NodaJsonSettings)
Configures Json.NET with everything required to properly serialize and deserialize NodaTime data types.
Since 3.2.x
Availability netstandard2.0
Declaration
public static JsonSerializer ConfigureForNodaTime(this JsonSerializer serializer, NodaJsonSettings nodaJsonSettings)
Parameters
Type | Name | Description |
---|---|---|
JsonSerializer | serializer | The existing serializer to add Noda Time converters to. |
NodaJsonSettings | nodaJsonSettings | The NodaJsonSettings to add to the Json.NET settings. |
Returns
Type | Description |
---|---|
JsonSerializer | The original serializer value, for further chaining. |
Remarks
Any converter property in
nodaJsonSettings
which is null will not be added to the list of
converters in serializer
.ConfigureForNodaTime(JsonSerializerSettings, IDateTimeZoneProvider)
Configures Json.NET with everything required to properly serialize and deserialize NodaTime data types.
Since 1.2.x
Availability netstandard2.0
Declaration
public static JsonSerializerSettings ConfigureForNodaTime(this JsonSerializerSettings settings, IDateTimeZoneProvider provider)
Parameters
Type | Name | Description |
---|---|---|
JsonSerializerSettings | settings | The existing settings to add Noda Time converters to. |
IDateTimeZoneProvider | provider | The time zone provider to use when parsing time zones and zoned date/times. |
Returns
Type | Description |
---|---|
JsonSerializerSettings | The original settings value, for further chaining. |
ConfigureForNodaTime(JsonSerializerSettings, NodaJsonSettings)
Configures Json.NET with everything required to properly serialize and deserialize NodaTime data types.
Since 3.2.x
Availability netstandard2.0
Declaration
public static JsonSerializerSettings ConfigureForNodaTime(this JsonSerializerSettings settings, NodaJsonSettings nodaJsonSettings)
Parameters
Type | Name | Description |
---|---|---|
JsonSerializerSettings | settings | The existing settings to add Noda Time converters to. |
NodaJsonSettings | nodaJsonSettings | The NodaJsonSettings to add to the Json.NET settings. |
Returns
Type | Description |
---|---|
JsonSerializerSettings | The original settings value, for further chaining. |
Remarks
Any converter property in
nodaJsonSettings
which is null will not be added to the list of
converters in settings
.WithIsoDateIntervalConverter(JsonSerializer)
Configures the given serializer to use IsoDateIntervalConverter.
Any other converters which can convert DateInterval are removed from the serializer.
Since 2.1.x
Availability netstandard2.0
Declaration
public static JsonSerializer WithIsoDateIntervalConverter(this JsonSerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
JsonSerializer | serializer | The existing serializer to add Noda Time converters to. |
Returns
Type | Description |
---|---|
JsonSerializer | The original serializer value, for further chaining. |
WithIsoDateIntervalConverter(JsonSerializerSettings)
Configures the given serializer settings to use IsoDateIntervalConverter.
Any other converters which can convert DateInterval are removed from the serializer.
Since 2.1.x
Availability netstandard2.0
Declaration
public static JsonSerializerSettings WithIsoDateIntervalConverter(this JsonSerializerSettings settings)
Parameters
Type | Name | Description |
---|---|---|
JsonSerializerSettings | settings | The existing serializer settings to add Noda Time converters to. |
Returns
Type | Description |
---|---|
JsonSerializerSettings | The original settings value, for further chaining. |
WithIsoIntervalConverter(JsonSerializer)
Configures the given serializer to use IsoIntervalConverter.
Any other converters which can convert Interval are removed from the serializer.
Since 1.3.x
Availability netstandard2.0
Declaration
public static JsonSerializer WithIsoIntervalConverter(this JsonSerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
JsonSerializer | serializer | The existing serializer to add Noda Time converters to. |
Returns
Type | Description |
---|---|
JsonSerializer | The original serializer value, for further chaining. |
WithIsoIntervalConverter(JsonSerializerSettings)
Configures the given serializer settings to use IsoIntervalConverter.
Any other converters which can convert Interval are removed from the serializer.
Since 1.3.x
Availability netstandard2.0
Declaration
public static JsonSerializerSettings WithIsoIntervalConverter(this JsonSerializerSettings settings)
Parameters
Type | Name | Description |
---|---|---|
JsonSerializerSettings | settings | The existing serializer settings to add Noda Time converters to. |
Returns
Type | Description |
---|---|
JsonSerializerSettings | The original settings value, for further chaining. |