Skip to content

Version 0.10

Compare
Choose a tag to compare
@Tarmil Tarmil released this 02 Mar 16:55
  • #47: Add Skippable<'T> to represent values that can be omitted from the serialization of a record or a union with NamedFields. This is particularly useful with Skippable<'T option> (or voption) to represent a field that can be omitted, null, or have a proper value.
    type R = { x: Skippable<int option> }
    
    { x = Skip }              // Serialized as: {}
    { x = Include None }      // Serialized as: {"x":null}
    { x = Include (Some 42) } // Serialized as: {"x":42}
    Also add a Skippable module with standard functions: map, filter, etc. Implementation largely based on @cmeeren's JsonSkippable which provides the same functionality for Newtonsoft.Json.
  • #51: When the type K is a single-case union wrapping a string, serialize Map<K, V> into a JSON object, like Map<string, V>.
  • Allow OR-ing a base JsonUnionEncoding (AdjacentTag, InternalTag, ExternalTag or Untagged) with Default to use the default extra options (UnwrapOption ||| UnwrapSingleCaseUnions).