package jsont

  1. Overview
  2. Docs
Declarative JSON data manipulation for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

jsont-0.1.1.tbz
sha512=e3f403d12283ac932b08254bf5d5debd3dbec1c9022e21f69b1be3fb74727da3ae7d26510eba6770451a6c711987884d93a3ee5baa94ca3a07166ad779206da5

doc/jsont/Jsont/Object/Mems/index.html

Module Object.Mems

Uniform members.

Maps

type 'a jsont := 'a t
type ('mems, 'a) enc = {
  1. enc : 'acc. (Meta.t -> string -> 'a -> 'acc -> 'acc) -> 'mems -> 'acc -> 'acc;
}

The type for specifying unknown members encoding function. A function to fold over unknown members of uniform type 'a stored in a value of type 'mems.

type ('mems, 'a, 'builder) map

The type for mapping members of uniform type 'a to values of type 'mems using a builder of type 'builder.

val map : ?kind:string -> ?doc:string -> ?dec_empty:(unit -> 'builder) -> ?dec_add:(Meta.t -> string -> 'a -> 'builder -> 'builder) -> ?dec_finish:(Meta.t -> 'builder -> 'mems) -> ?enc:('mems, 'a) enc -> 'a jsont -> ('mems, 'a, 'builder) map

map type' maps unknown members of uniform type 'a to values of type 'mems built with type 'builder.

  • kind names the entities represented by the map and doc documents them. Both default to "".
  • dec_empty is used to create a builder for the members. Can be omitted if the map is only used for encoding, the default unconditionally errors.
  • dec_add meta name v b is used to add a member named name with meta meta with member value v to builder b. Can be omitted if the map is only used for encoding, the default unconditionally errors.
  • dec_finish meta b converts the builder to the final members value. meta is the metadata of the object in which they were found. Can be omitted if the map is only used for encoding, the default unconditionally errors.
  • enc f mems acc folds over the elements of mems starting with acc. This function is used to encode the members. Can be omitted if the map is only used for decoding, the default unconditionally errors.

See keep_unknown.

val string_map : ?kind:string -> ?doc:string -> 'a jsont -> ('a Map.Make(String).t, 'a, 'a Map.Make(String).t) map

string_map t collects unknown member by name and types their values with t. See keep_unknown and as_string_map.

OCaml

Innovation. Community. Security.

On This Page
  1. Maps