FSharp.Json
FSharp.Json copied to clipboard
Custom enum/union parsing/serialization
Hi, I want to serialize a type such as:
type State =
| None
| OverflowedState
| RestartedState
type Main =
{ State: State
}
to have the following JSON:
{
"state": "<none|overflowed_state|restarted_state>"
}
I tried using transforms for this, but they don't seem to get called for enum/union values. Is there any way to do it?
I see the problem - I will take a look at this.
ping?
Any changes here?
Can borrow scheme and some impl from https://github.com/eiriktsarpalis/TypeShape/blob/main/src/TypeShape/Applications/UnionContract.fs#L9