package js_of_ocaml

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Typesafe IO (based on the deriving library).

type 'a t

The type of JSON parser/printer for value of type 'a.

val make : (Buffer.t -> 'a -> unit) -> (Deriving_Json_lexer.lexbuf -> 'a) -> 'a t
val write : 'a t -> Buffer.t -> 'a -> unit
val read : 'a t -> Deriving_Json_lexer.lexbuf -> 'a
val to_string : 'a t -> 'a -> string

to_string Json.t<ty> v marshal the v of type ty to a JSON string.

val from_string : 'a t -> string -> 'a

from_string Json.t<ty> s safely unmarshal the JSON s into an OCaml value of type ty. Throws Failure if the received value isn't the javascript representation of a value of type ty.

module type Json = sig ... end

The signature of the JSON class.

Deriver

module type Json_min = sig ... end
module type Json_min' = sig ... end
module type Json_min'' = sig ... end
module Defaults (J : Json_min) : Json with type a = J.a
module Defaults' (J : Json_min') : Json with type a = J.a
module Defaults'' (J : Json_min'') : Json with type a = J.a
module Json_char : Json with type a = char
module Json_bool : Json with type a = bool
module Json_unit : Json with type a = unit
module Json_int : Json with type a = int
module Json_int32 : Json with type a = int32
module Json_int64 : Json with type a = int64
module Json_nativeint : Json with type a = nativeint
module Json_float : Json with type a = float
module Json_string : Json with type a = string
module Json_list (A : Json) : Json with type a = A.a list
module Json_ref (A : Json) : Json with type a = A.a ref
module Json_option (A : Json) : Json with type a = A.a option
module Json_array (A : Json) : Json with type a = A.a array
val read_list : (Deriving_Json_lexer.lexbuf -> 'a) -> Deriving_Json_lexer.lexbuf -> 'a list
val write_list : (Buffer.t -> 'a -> unit) -> Buffer.t -> 'a list -> unit
val write_ref : (Buffer.t -> 'a -> unit) -> Buffer.t -> 'a ref -> unit
val read_option : (Deriving_Json_lexer.lexbuf -> 'a) -> Deriving_Json_lexer.lexbuf -> 'a option
val write_option : (Buffer.t -> 'a -> unit) -> Buffer.t -> 'a option -> unit
val read_array : (Deriving_Json_lexer.lexbuf -> 'a) -> Deriving_Json_lexer.lexbuf -> 'a array
val write_array : (Buffer.t -> 'a -> unit) -> Buffer.t -> 'a array -> unit
OCaml

Innovation. Community. Security.