Module Tpf_json.Dec
Generic JSON decoder.
Records are expected as JSON objects, and constant constructors are expected as JSON strings.
The representation of variants is determined by the ~sum argument (default arr).
Generic function
type sum= (string * json list) dSum-destructuring functions.
f jsonisOk (name, args)whenjsonencodes a constructor namednamewith argumentsargs, orError _otherwise.
val arr : sumDestructures
K (a0, a1, ...)from["K", a0, a1, ...].
val obj : ?tag:string -> ?values:string -> sumDestructures
K (a0, a1, ...)from{ tag: "K", values: [a0, a1, ...]}.tagdefaults to"tag"andvaluesdefaults to"values".
val g_of_json : ?sum:sum -> ('a, p) Tpf.schema -> 'a d
data interface
val data0 : ?sum:sum -> 'x Tpf.data0 -> 'x dval data1 : ?sum:sum -> ('a, 'x) Tpf.data1 -> 'a d -> 'x dval data2 : ?sum:sum -> ('a, 'b, 'x) Tpf.data2 -> 'a d -> 'b d -> 'x dval data3 : ?sum:sum -> ('a, 'b, 'c, 'x) Tpf.data3 -> 'a d -> 'b d -> 'c d -> 'x dval data4 : ?sum:sum -> ('a, 'b, 'c, 'd, 'x) Tpf.data4 -> 'a d -> 'b d -> 'c d -> 'd d -> 'x dval data5 : ?sum:sum -> ('a, 'b, 'c, 'd, 'e, 'x) Tpf.data5 -> 'a d -> 'b d -> 'c d -> 'd d -> 'e d -> 'x dval data6 : ?sum:sum -> ('a, 'b, 'c, 'd, 'e, 'f, 'x) Tpf.data6 -> 'a d -> 'b d -> 'c d -> 'd d -> 'e d -> 'f d -> 'x dval data7 : ?sum:sum -> ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'x) Tpf.data7 -> 'a d -> 'b d -> 'c d -> 'd d -> 'e d -> 'f d -> 'g d -> 'x dval data8 : ?sum:sum -> ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'x) Tpf.data8 -> 'a d -> 'b d -> 'c d -> 'd d -> 'e d -> 'f d -> 'g d -> 'h d -> 'x dval data9 : ?sum:sum -> ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'x) Tpf.data9 -> 'a d -> 'b d -> 'c d -> 'd d -> 'e d -> 'f d -> 'g d -> 'h d -> 'i d -> 'x d