module Json:sig..end
Functions for generating Json data.
type json =
| |
String of |
| |
Num of |
| |
Float of |
| |
Bool of |
| |
Null |
| |
Array of |
| |
Object of |
The type of json data.
val string : string -> json(string s) is (String s).
val num : int -> json(num n) is (Num n).
val float : float -> json(float f) is (Float f).
val bool : bool -> json(bool b) is (Bool b).
val null : 'a -> json(null x) is Null.
val array : ('a -> json) -> 'a list -> json(array f xs) is (Array (map f xs)).
val obj : ('a -> json) -> (string * 'a) list -> json(obj f alist) is (Object (map (fun (s,x) -> s, f x) alist)).
val of_option : ('a -> json) -> 'a option -> json(of_option f (Some x)) is (f x) and (of_option f None) is Null.
val to_string : ?minify:bool -> json -> string(to_string ?minify json): convert a json data structure to a string in
Json representation.
val callback : ?minify:bool -> string -> json -> string(callback ?minify cb json): convert a json data structure to a string
in "Json callback" representation. You should use
Restful.Json.content_type as your content-type.
val valid_id : string -> bool
val content_type : stringThe correct content-type for Json data.
val json_of_jsonm : ([< `A of 'a list
| `Bool of bool
| `Float of float
| `Null
| `O of (string * 'a) list
| `String of string ]
as 'a) ->
json