Json with embedded expressions utilities.
val assoc : (string * Json_spel_t.json_spel) list ‑> Json_spel_t.json_spel
assoc o
build the JSON object o
.
json
/json_spel
conversionval to_json : Json_spel_t.json_spel ‑> Wcs_t.json
to_json v
convert v
value into json
. Expressions are turned
into strings with using the Spel concrete syntax.
val of_json : Wcs_t.json ‑> Json_spel_t.json_spel
of_json j
convert j
into json_spel
. Strings literals in
j
are parsed as text containing quoted spel expressions.
val set : Json_spel_t.json_spel ‑> string ‑> Json_spel_t.json_spel ‑> Json_spel_t.json_spel
set o x v
add (or replace) the a field x
of the object o
with
value v
.
val get : Json_spel_t.json_spel ‑> string ‑> Json_spel_t.json_spel option
get o x
gets the value of the field x
of the object o
.
val take : Json_spel_t.json_spel ‑> string ‑> Json_spel_t.json_spel * Json_spel_t.json_spel option
take o x
gets the value of the field x
of the object o
and
remove the field from the object. The left part of the return value
is the modified object and the right part is the value of the
field.
val assign : Json_spel_t.json_spel list ‑> Json_spel_t.json_spel
assign [o1; ...; on]
create a json object that contains all the
fields of the objets o1
, ..., on
. It is similare the the JavaScript
function Object.assing({}, o1, ... on)
.
val push : Json_spel_t.json_spel ‑> string ‑> Json_spel_t.json_spel ‑> Json_spel_t.json_spel
push o x v
add the value v
in the list stored in a field x
of the object o
. It the field x
doesn't exists, it creates it.
val pop : Json_spel_t.json_spel ‑> string ‑> Json_spel_t.json_spel * Json_spel_t.json_spel option
pop o x
take a value in a list stored in the field x
of o
.
val set_bool : Json_spel_t.json_spel ‑> string ‑> bool ‑> Json_spel_t.json_spel
set_bool o x b
sets the a field x
of the object o
with value
b
.
val get_bool : Json_spel_t.json_spel ‑> string ‑> bool option
get_bool o x
gets the value of the field x
of the object o
.
val set_string : Json_spel_t.json_spel ‑> string ‑> string ‑> Json_spel_t.json_spel
set_string o x x
sets the a field x
of the object o
with string
s
.