package orsetto
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=6e6f59fc6a2c590b1b377e40f2120a548e6f09e61e7eb12ffa45cf2d517316b8
md5=533153cd4a9fe8093d3b98afc1073bc8
doc/orsetto.json/Json_emit/index.html
Module Json_emit
JavaScript Object Notation (JSON) output formatter.
Overview
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
type 'a t = private 'a Cf_emit.To_formatter.t
The type of JSON emitters.
Abstract Data
module Render : sig ... end
A submodule to encapsulate functions for use with data rendering models.
Basic Emitters
val null : unit t
The emitter for the JSON null literal
val boolean : bool t
The emitter for JSON boolean values.
val integer : int t
The emitter for integers as JSON numeric values.
val int32 : int32 t
The emitter for 32-bit integers as JSON numeric values.
val int64 : int64 t
The emitter for 64-bit integers as JSON numeric values.
val float : float t
The emitter for floats as JSON numeric values.
val string : Ucs_text.t t
The 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 t
Use 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.
Opaque Types
module Opaque : sig ... end
A submodule containing logic for emitting JSON texts from values of type Cf_type.opaque
according to optional mode selectors.
Deprecated
val to_text : Cf_type.opaque -> Ucs_text.t
Use 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 t
An opaque value emitter created by Opaque.value
with default mode.