Closed colinbull closed 8 years ago
This makes sense actually, as at the moment there's no way of serializing an unsupported top level type. We have writeWith and readWith for when an unsupportable type is part of a larger scope, but this does make perfect sense for your case (and I'm sure you won't be unique).
I'll get this merged in later on tonight and a new package pushed out.
Nice! Thanks.
Merged in - look for 6.1.0 appearing shortly...
I have added a convenience method
serializeWith
which allows you to delegate to a function. An example might be truncating the time component of a DateTime .this is also useful when you cannot enhance a type with the
ToJson
method because you may not know the closed form of the type. For exampleResult<'a, Error>
in this case I can't create an extension method as the F# compiler doesn't support it, so this PR lets me do something like,I'm only playing with this seriously for the first time but I couldn't see any obvious way of doing what I wanted to achieve. Open to suggestions if there is a way to do this.