package cpdf

  1. Overview
  2. Docs
type t =
  1. | String of string
  2. | Number of string
  3. | Object of obj
  4. | Array of t list
  5. | Bool of bool
  6. | Null
and obj = (string * t) list
exception JSON_NotObject of t
exception JSON_InvalidField of string
exception JSON_CastErr of string
exception JSON_UnknownErr of string
val show : t -> string

Printer and formatter

val format : Format.formatter -> t -> unit
Object field access
val getf : string -> t -> t

Get field from an object. Failure raises an exception.

val getf_opt : string -> t -> t option

Get field from an object. Failure is reported as None

val as_bool : t -> bool

Coercions. They may fail and raise JSON_CastErr.

val as_object : t -> obj
val as_float : t -> float
val as_string : t -> string
val as_list : t -> t list
val as_int : t -> int
val parse_ch : in_channel -> t

Parsers

val parse : string -> t
val parse_function : (bytes -> int -> int) -> t
OCaml

Innovation. Community. Security.