Jsont.Json
Generic JSON values.
find_mem n ms
find the first member whose name matches n
in ms
.
The type for constructing JSON values from an OCaml value of type 'a
. meta
defaults to Meta.none
.
val null : unit cons
null
is Null (unit, meta)
.
val bool : bool cons
bool b
is Bool (b, meta)
.
val number : float cons
number n
is Number (n, meta)
.
val string : string cons
string s
is String (s, meta)
.
option c
constructs Some v
values with c v
and None
ones with null
.
val int : int cons
int
is i
as a JSON number or a JSON string if not in the range [-253;253]. See also int_as_string
.
val int32 : int32 cons
int32
is i
as a JSON number.
val int64 : int64 cons
int64 i
is i
as a JSON number or a JSON string if not in the range [-253;253]. See also int64_as_string
.
val any_float : float cons
any_float v
is number v
if Float.is_finite
v
is true
and string (Float.to_string v)
otherwise. See Jsont.any_float
.
dcode t j
decodes a value from the generic JSON j
according to type t
. ctx
defaults to Context.root
.
decode'
is like decode
but preserves the error structure.
encode t v
encodes a generic JSON value for v
according to type t
. ctx
default to Contet.root
.
encode'
is like encode
but preserves the error structure.
error_sort p m ~exp fnd
errors when sort exp
was expected but generic JSON fnd
was found.