module Json_io:Input and output functions for the JSON format as defined by http://www.json.org/sig
..end
val json_of_string : ?allow_comments:bool -> ?big_int_mode:bool -> string -> Json_type.t
json_of_string s
reads the given JSON string.
If allow_comments
is true
, then C++ style comments are allowed, i.e.
/* blabla possibly on several lines */
or
// blabla until the end of the line
. Comments are not part of the JSON
specification and are disabled by default.
If big_int_mode
is true
, then JSON ints that cannot be represented
using OCaml's int type are represented by strings.
This would happen only for ints that are out of the range defined
by min_int
and max_int
, i.e. [-1G, +1G[ on a 32-bit platform.
The default is false
and a Json_type.Json_error
exception
is raised if an int is too big.
val load_json : ?allow_comments:bool -> ?big_int_mode:bool -> string -> Json_type.t
Json_io.json_of_string
but the argument is a file
to read from.module Compact:sig
..end
module Fast:sig
..end
module Pretty:sig
..end
val string_of_json : ?compact:bool -> Json_type.t -> string
string_of_json
converts JSON data to a string.
By default, the output is indented. If the compact
flag is set to true,
the output will not contain superfluous whitespace and will
be produced faster.
val save_json : ?compact:bool -> string -> Json_type.t -> unit
save_json
works like Json_io.string_of_json
but
saves the results directly into the file specified by the
argument of type string.