Module B0_json.G

module G: sig .. end
JSON value generation.


Generation


type json = B0_json.t 
The type generic json representations.
type 'a seq 
The type for sequences.
val empty : 'a seq
An empty sequence.
val (++) : 'a seq -> 'a seq -> 'a seq
s ++ s' is sequence s' concatenated to s.
type t 
The type for generated JSON values.
type mem 
The type for generated JSON members.
type el 
The type for generated JSON array elements.
val null : t
null is the generated JSON null value.
val bool : bool -> t
bool b is b as a generated JSON boolean value.
val int : int -> t
int i is i as a generated JSON number.
val float : float -> t
float f is f as a generated JSON number.
val string : string -> t
str s is s as a generated JSON string value.
val el : t -> el seq
el v is v as a generated JSON array element.
val el_if : bool -> (unit -> t) -> el seq
el_if c v is el (v ()) if c is true and B0_json.G.empty otherwise.
val arr : el seq -> t
arr els is a generated array whose values are generated by the elements els.
val mem : string -> t -> mem seq
mem name v is a generated object member whose name is name and value is v.
val mem_if : bool -> string -> (unit -> t) -> mem seq
mem_if c name v is mem name v if c is true and B0_json.G.empty otherwise.
val obj : mem seq -> t
obj mems is a generated object whose members are generated by mems.
val of_json : json -> t
of_json v is the JSON value v as a generated value.

Output


val to_string : t -> string
to_string g is the generated JSON value g as a string.
val output : Pervasives.out_channel -> t -> unit
output oc g outputs the generated JSON value g on oc.
val buffer_add : Buffer.t -> t -> unit
buffer_add b g adds the generated JSON value g to b.