ServiceStack.Text
JSON serialization support for NodaTime v2
. This library will work with v5.0
and later versions of ServiceStack.Text
.
DateTimeZoneProviders.Tzdb
.CreateDefaultSerializersForNodaTime()
.ConfigureSerializersForNodaTime();
There are static extension methods to allow for optional fluent configuration.
DateTimeZoneProviders.Tzdb.CreateDefaultSerializersForNodaTime()
.WithIsoIntervalSerializer()
.ConfigureSerializersForNodaTime();
DateTimeZoneProviders.Tzdb.CreateDefaultSerializersForNodaTime()
.WithNormalizingIsoPeriodSerializer()
.ConfigureSerializersForNodaTime();
//You could create you own serializer by implementing IServiceStackSerializer<T>
NodaSerializerDefinitions.LocalTimeSerializer.ConfigureSerializer();
Alternatively, you can create your own implementation of INodaSerializerSettings
to suit your specific needs.
The SerivceStack.Text
serializer uses the same default serialization formats as those used in the Json.NET
serializers. You can optionally change the Interval
serializer to use the ISO 8601
Interval spec.
- Serializer setup should only occur once in your application root.
- Serialization setup should occur before any serialization occurs with
ServiceStack.Text
or there may be undesirable behavior. - If using with ServiceStack, serializer setup should occur before Init of the AppHost.
- For Value types, this will also setup the nullable serializer for that value type.
- Since this is a custom serializer for
ServiceStack.Text
, calls toJsConfig.Reset()
will remove the custom serializers.
- Install the NuGet Package
- NuGet Packages from Latest Successful Build
- You can check out the code and run
build.bat
. It will create NuGet packages you can consume in.\ReleasePackages
or you can directly use the resulting binaries.
JetBrains TeamCity CI Build Status:
Special Thanks to JetBrains for hosting this project!