Closed wallymathieu closed 2 years ago
Seems like it compiles if I do:
type PersonF = {
name : string * string
age : int option
children: PersonF list }
with
static member JsonObjCodec =
fun f l a c -> { name = (f, l); age = a; children = c }
|> withFields
|> jfield "firstName" (fun x -> fst x.name)
|> jfield "lastName" (fun x -> snd x.name)
|> jfieldOpt "age" (fun x -> x.age)
|> jfieldWith jsonValueCodec "children" (fun x -> x.children)
Since changes and additions in 0.10.0 the Readme was completely upgraded.
This example does compile
#r "nuget: Fleece.SystemJson, 0.10.0"
#r "nuget: System.Json, 4.7.1"
open System.Json
open Fleece.SystemJson
open Fleece.SystemJson.Operators
type PersonF = {
name : string * string
age : int option
children: PersonF list }
with
static member JsonObjCodec =
fun f l a c -> { name = (f, l); age = a; children = c }
|> withFields
|> jfield "firstName" (fun x -> fst x.name)
|> jfield "lastName" (fun x -> snd x.name)
|> jfieldOpt "age" (fun x -> x.age)
|> jfield "children" (fun x -> x.children)