Module Tpf_json

Generic JSON converters.

Generic injections / projections between a type and a general purpose JSON tree.

The tree type is non-generative, so it works with any underlying library for (de-)serialization. Howerver, the particular tree shape was chosen for compatibility with Joyson.

type json = [
| `Null
| `Bool of bool
| `Int of int
| `Float of float
| `String of string
| `List of json list
| `Assoc of (string * json) list
]

JSON trees.

Note. This is Yojson.Basic.t.

type error = [
| `Msg of string
]

Decoder error.

val pp_error : Stdlib.Format.formatter -> error -> unit

pp_error ppf e pretty-prints e on ppf.

Encoders

type 'a e = 'a -> json

Encoder type.

module Enc : sig ... end

Generic JSON encoder.

Decoders

type 'a d = json -> ('aerror) Stdlib.result

Decoder type.

module Dec : sig ... end

Generic JSON decoder.