Noda Time
Show / Hide Table of Contents

Class Extensions

Static class containing extension methods to configure System.Text.Json for Noda Time types.
Since 1.0.x
Availability net6.0, netstandard2.0
Inheritance
object
Extensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: NodaTime.Serialization.SystemTextJson
Assembly: NodaTime.Serialization.SystemTextJson.dll
Syntax
public static class Extensions

Methods

ConfigureForNodaTime(JsonSerializerOptions, IDateTimeZoneProvider)

Configures System.Text.Json with everything required to properly serialize and deserialize NodaTime data types.
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static JsonSerializerOptions ConfigureForNodaTime(this JsonSerializerOptions options, IDateTimeZoneProvider provider)
Parameters
Type Name Description
JsonSerializerOptions options The existing options 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
JsonSerializerOptions The original options value, for further chaining.

ConfigureForNodaTime(JsonSerializerOptions, NodaJsonSettings)

Configures System.Text.Json with everything required to properly serialize and deserialize NodaTime data types.
Since 3.2.x
Availability net6.0, netstandard2.0
Declaration
public static JsonSerializerOptions ConfigureForNodaTime(this JsonSerializerOptions options, NodaJsonSettings nodaJsonSettings)
Parameters
Type Name Description
JsonSerializerOptions options The existing options to add Noda Time converters to.
NodaJsonSettings nodaJsonSettings The NodaJsonSettings to add to the System.Text.Json options.
Returns
Type Description
JsonSerializerOptions The original options value, for further chaining.
Remarks
Any converter property in nodaJsonSettings which is null will not be added to the list of converters in options.

WithIsoDateIntervalConverter(JsonSerializerOptions)

Configures the given serializer settings to use IsoDateIntervalConverter. Any other converters which can convert DateInterval are removed from the serializer.
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static JsonSerializerOptions WithIsoDateIntervalConverter(this JsonSerializerOptions options)
Parameters
Type Name Description
JsonSerializerOptions options The existing serializer settings to add Noda Time converters to.
Returns
Type Description
JsonSerializerOptions The original options value, for further chaining.

WithIsoIntervalConverter(JsonSerializerOptions)

Configures the given serializer settings to use IsoIntervalConverter. Any other converters which can convert Interval are removed from the serializer.
Since 1.0.x
Availability net6.0, netstandard2.0
Declaration
public static JsonSerializerOptions WithIsoIntervalConverter(this JsonSerializerOptions options)
Parameters
Type Name Description
JsonSerializerOptions options The existing serializer settings to add Noda Time converters to.
Returns
Type Description
JsonSerializerOptions The original options value, for further chaining.
In this article
Back to top Generated by DocFX