I added a new AsValue to the UnionMode. This will be useful when the field can be one of a type, such as a int or a string. But this cannot be deserialised.
For example:
[<JsonUnion(Mode = UnionMode.AsValue)>]
type AsValueUnion =
| StringCase of string
| IntCase of int
type RecordWithAsValueUnion = {
StringValue : AsValueUnion
IntValue : AsValueUnion
}
let record = { StringValue = StringCase "String"; IntValue = IntCase 1 }
will be serialised like a {"StringValue":"String","IntValue":1}
I added a new AsValue to the UnionMode. This will be useful when the field can be one of a type, such as a int or a string. But this cannot be deserialised.
For example:
will be serialised like a {"StringValue":"String","IntValue":1}