Metadb.Json
This is a wrapper for the Yojson
library
type t = [
| `Null |
| `Bool of bool |
| `Int of int |
| `Float of float |
| `String of string |
| `Assoc of (string * t) list |
| `List of t list |
]
Type of Basic Json values
Get value of a key in a Json association list. Returns none if key is not found. Raises ParsingFailure
if not an association list
Same as get
but raises ParsingFailure
if key is unbound
Add entry to an association list and raise ParsingFailure
if not an association list
Remove entry from association list and raise ParsingFailure
if not an association list
Convert a Json list to a list. Raise ParsingFailure
if not a list
val to_int : t -> int
Convert a Json int to an int. Raise ParsingFailure
if not an int
val to_string : t -> string
Convert Json string to a string. Raise ParsingFailure
if not a string
val to_bool : t -> bool
Convert Json bool to bool. Raise ParsingFailure
if not a bool
Convert t
option
to t
and raise ParsingFailure
with message specified by the first argument if None
or `Null
val write_string : t -> string
Write Json to string in a compact way
val pretty_to_string : t -> string
Write Json to string in a readable way
val from_string : string -> t
Parse Json from string