package tiny_json

  1. Overview
  2. Docs

Module Tiny_json.JsonSource

Sourcetype t =
  1. | String of string
  2. | Number of string
  3. | Object of obj
  4. | Array of t list
  5. | Bool of bool
  6. | Null
Sourceand obj = (string * t) list
Sourceexception JSON_NotObject of t
Sourceexception JSON_InvalidField of string
Sourceexception JSON_CastErr of string
Sourceexception JSON_UnknownErr of string
Sourceval show : t -> string

Printer and formatter

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

Get field from an object. Failure raises an exception.

Sourceval getf_opt : string -> t -> t option

Get field from an object. Failure is reported as None

Sourceval as_bool : t -> bool

Coercions. They may fail and raise JSON_CastErr.

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

Parsers

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

Innovation. Community. Security.