Serializing F# Option types

后端 未结 2 1964
不知归路
不知归路 2021-01-17 20:44

Consider the F# fragment below:

type MyType = {  
    CrucialProperty: int
    OptionalProperty: string option 
}

let first = { CrucialProperty = 500; Optio         


        
2条回答
  •  既然无缘
    2021-01-17 21:17

    The FSharp.JsonSkippable library allows you to control in a simple and strongly typed manner whether to include a given property when serializing (and determine whether a property was included when deserializing), and moreover, to control/determine exclusion separately of nullability. (Full disclosure: I'm the author of the library.)

提交回复
热议问题