Skip to content

Instantly share code, notes, and snippets.

@kolektiv
Created October 12, 2016 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kolektiv/c7674a9ee26bc7f34b3c98203b664d58 to your computer and use it in GitHub Desktop.
Save kolektiv/c7674a9ee26bc7f34b3c98203b664d58 to your computer and use it in GitHub Desktop.
Serialize
type Address =
{ Street: string
Number: int }
static member ToJson (x: Address) =
json {
do! Json.write "street" x.Street
do! Json.write "streetNumber" x.Number }
type House =
{ Inhabitant: string
Address: Address }
static member ToJson (x: House) =
json {
do! Json.write "inhabitant" x.Inhabitant
do! Json.write "address" x.Address }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment