Page
Library
Module
Module type
Parameter
Class
Class type
Source
Jsont.Json
SourceGeneric JSON values.
The type for constructing JSON values from an OCaml value of type 'a
. meta
defaults to Meta.none
.
See Jsont.json
.
copy_layout src ~dst
copies the layout of src
and sets it on dst
using Meta.copy_ws
.
zero j
is a stub value of the sort value of j
. The stub value is the “natural” zero: null, false, 0, empty string, empty array, empty object.
compare j0 j1
is a total order on JSON values:
Float.compare
, this means NaN values are equal.Meta.t
values are ignored.See Jsont.pp_json
.
option c
constructs Some v
values with c v
and None
ones with null
.
any_float v
is number v
if Float.is_finite
v
is true
and string (Float.to_string v)
otherwise. See Jsont.any_float
.
int64 i
is i
as a JSON number or a JSON string if not in the range [-253;253]. See also int64_as_string
.
int
is i
as a JSON number or a JSON string if not in the range [-253;253]. See also int_as_string
.
name ?meta n
is (n, meta)
. meta
defaults to Meta.none
.
find_mem n ms
find the first member whose name matches n
in ms
.
decode t j
decodes a value from the generic JSON j
according to type t
.
decode'
is like decode
but preserves the error structure.
encode t v
encodes a generic JSON value for v
according to type t
.
encode'
is like encode
but preserves the error structure.
recode t v
decodes v
with t
and encodes it with t
.
recode'
is like recode
but preserves the error structure.
error_sort ~exp fnd
errors when sort exp
was expected but generic JSON fnd
was found.