Json_emitJavaScript Object Notation (JSON) output formatter.
Specialization of
f_emit
to output texts in the JSON format. Combinators are provided for the basic JSON types to be used for directly emitting application data as JSON text. Additional conveniences are provided for emitting encapsulated JSON values as text. All output is encoded in UTF-8.
type 'a t = private 'a Cf_emit.To_formatter.tThe type of JSON emitters.
module Render : sig ... endA submodule to encapsulate functions for use with data rendering models.
val null : unit tThe emitter for the JSON null literal
val boolean : bool tThe emitter for JSON boolean values.
val integer : int tThe emitter for integers as JSON numeric values.
val int32 : int32 tThe emitter for 32-bit integers as JSON numeric values.
val int64 : int64 tThe emitter for 64-bit integers as JSON numeric values.
val float : float tThe emitter for floats as JSON numeric values.
val string : Ucs_text.t tThe emitter for Unicode texts as JSON string literals.
Use array f to make an emitter for values represented as JSON arrays. Applies the emitted value to f and elaborates the returned sequence of sealed emitters as a JSON array.
val objval : ('a -> (Ucs_text.t * unit t) Seq.t) -> 'a tUse objval f to make an emitter for values represented as JSON objects. Applies the emitted value to f and elaborates the returned sequence of key/value pairs as a JSON object. The value of each field is a sealed emitter.
module Opaque : sig ... endA submodule containing logic for emitting JSON texts from values of type Cf_type.opaque according to optional mode selectors.
val to_text : Cf_type.opaque -> Ucs_text.tUse to_text v to format v as a Unicode text. Raises Invalid_argument if v was not witnessed with a type compatible with JSON encoding.
val value : Cf_type.opaque tAn opaque value emitter created by Opaque.value with default mode.