I am using record types in a F# project that I am exposing to a C# WebApi project. For example:
type Account = {Amount:float; Number:int; Holder:string}
Based on this post and this post, the json is serializaing correctly.
{"Amount":100.0,"Number":1,"Holder":"Homer"}
However, when I add in a option type to the record,
type Account = {Amount:float; Number:int; Holder:string option }
the json becomes unglued.
{"Amount":100.0,"Number":1,"Holder":{"Case":"Some","Fields":["Homer"]}}
I would want the json to look the same as the non-option type record with the serializer being smart enough to take the values and put them in/out of the option type automatically.
Has anyone built a custom formatter to this end? Is there something OOB that I am missing?
Thanks