Json utilities.
val read_json_file : (Yojson.lexer_state ‑> Lexing.lexbuf ‑> 'a) ‑> string ‑> 'a
read_json_file reader fname
reads the file fname
using the
reader reader
generated by atdgen.
val set : Wcs_t.json ‑> string ‑> Wcs_t.json ‑> Wcs_t.json
set o x v
add (or replace) the a field x
of the object o
with
value v
.
val get : Wcs_t.json ‑> string ‑> Wcs_t.json option
get o x
gets the value of the field x
of the object o
.
val take : Wcs_t.json ‑> string ‑> Wcs_t.json * Wcs_t.json 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 : Wcs_t.json list ‑> Wcs_t.json
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 : Wcs_t.json ‑> string ‑> Wcs_t.json ‑> Wcs_t.json
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 : Wcs_t.json ‑> string ‑> Wcs_t.json * Wcs_t.json option
pop o x
take a value in a list stored in the field x
of o
.
val set_bool : Wcs_t.json ‑> string ‑> bool ‑> Wcs_t.json
set_bool o x b
sets the a field x
of the object o
with value
b
.
val get_bool : Wcs_t.json ‑> string ‑> bool option
get_bool o x
gets the value of the field x
of the object o
.
val set_string : Wcs_t.json ‑> string ‑> string ‑> Wcs_t.json
set_string o x x
sets the a field x
of the object o
with string
s
.
val get_string : Wcs_t.json ‑> string ‑> string option
get_string o x
gets the value of the field x
of the object o
.
val take_string : Wcs_t.json ‑> string ‑> Wcs_t.json * string option
take_string o x
takes the value of the field x
of the object o
.