Home

Awesome

Utf8Json.FSharpExtensions

NuGet Status Build status Build Status

Utf8Json.FSharpExtensions is a Utf8Json extension library for F#.

Usage

open Utf8Json
open Utf8Json.Resolvers
open Utf8Json.FSharp

CompositeResolver.RegisterAndSetAsDefault(
  FSharpResolver.Instance,
  StandardResolver.Default
)

type Person = {
  Age: int
  FirstName: string
  LastName: string
  MiddleName: string option
}

let p = {
  Age = 99
  FirstName = "foo"
  LastName = "buz"
  MiddleName = Some "bar"
}

let result = JsonSerializer.Serialize(p)
let p2 = JsonSerializer.Deserialize<Person>(result)