Using System.Text.Json, we can serialize Option<T> values to this:
{
"Value": 42,
"IsSome": true,
"IsNone": false
}
but not deserialize it (it returns Option<T>.None).
The library should provide be a converter.
The JSON format could be something like this:
// Some
{
"Value": 42
}
// None
{}
Note: serialization with Newtonsoft.Json works as expected (with the IsSome/IsNone properties)
Using System.Text.Json, we can serialize
Option<T>values to this:{ "Value": 42, "IsSome": true, "IsNone": false }but not deserialize it (it returns
Option<T>.None).The library should provide be a converter.
The JSON format could be something like this:
Note: serialization with Newtonsoft.Json works as expected (with the IsSome/IsNone properties)