Duration duration = Duration.FromTicks(216000000000); var DurationConverter = new NodaPatternConverter<Duration>(DurationPattern.CreateWithInvariantCulture("SS")); JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings(); jsonSerializerSettings.TypeNameHandling = TypeNameHandling.Auto; jsonSerializerSettings.ConfigureForNodaTime(DateTimeZoneProviders.Serialization); jsonSerializerSettings.Converters.Clear(); jsonSerializerSettings.Converters.Add(DurationConverter); File.WriteAllText("file.json", JsonConvert.SerializeObject(duration, jsonSerializerSettings)); var readFileStr = File.ReadAllText("file.json"); var item = JsonConvert.DeserializeObject<Duration>(readFileStr, jsonSerializerSettings); Console.WriteLine(item.TotalTicks);
--
---
You received this message because you are subscribed to the Google Groups "Noda Time" group.
To unsubscribe from this group and stop receiving emails from it, send an email to noda-time+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/noda-time/a2ee9bac-806a-4c64-bba9-d8a56f8ed18e%40googlegroups.com.
--
---
You received this message because you are subscribed to the Google Groups "Noda Time" group.
To unsubscribe from this group and stop receiving emails from it, send an email to noda-time+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/noda-time/a5c619a8-ec56-4338-9cc5-c8e7da157353%40googlegroups.com.