module Json:sig..end
Remarks:
Number can be used to encode non OCaml-primitive numbers,
for instance Zarith.type t =
| |
Null |
| |
True |
| |
False |
| |
String of |
| |
Number of |
| |
Int of |
| |
Float of |
| |
Array of |
| |
Assoc of |
val equal : t -> t -> boolval compare : t -> t -> intval pp : Format.formatter -> t -> unit
exception Error of string * int * string
Error in case of error.val of_lexbuf : Lexing.lexbuf -> t
val of_channel : Pervasives.in_channel -> t
val of_string : string -> t
val of_file : string -> t~pretty:false.val to_string : ?pretty:bool -> t -> string
val to_buffer : ?pretty:bool -> Buffer.t -> t -> unit
val to_channel : ?pretty:bool -> Pervasives.out_channel -> t -> unit
val to_file : ?pretty:bool -> string -> t -> unitInvalid_argument in case of wrong
format.val bool : t -> boolTrue and False only.Invalid_argument when the conversion fails.val int : t -> intInt, Float, Number and String to an int.
Floats are truncated with int_of_float.Invalid_argument when the conversion fails.val float : t -> floatInt, Float, Number and String to float.Invalid_argument when the conversion fails.val array : t -> t arrayArray object.
Null is considered an empty array.Invalid_argument if the object is not an array.val list : t -> t listArray object.
Null is considered an empty list.Invalid_argument if the object is not a list.val fold : (string -> t -> 'a -> 'a) -> t -> 'a -> 'aNull is considered an empty object.
Typical usage is fold M.add t M.empty where M=Map.Make(String).Invalid_argument if the object is not an Assoc or Null object.val field : string -> t -> tNull is considered an empty object.Not_found if the field is absent from the object.Invalid_argument if the object is not an Assoc or Null object.