package aws

  1. Overview
  2. Docs

This module contains a Json type (compatible with Yojson.Basic.t) and helpers.

type t = [
  1. | `Assoc of (string * t) list
  2. | `Bool of bool
  3. | `Float of float
  4. | `Int of int
  5. | `List of t list
  6. | `Null
  7. | `String of string
]

Json type. This is compatible with Yojson.Basic.t

exception Casting_error of string * t

This is thrown in the case that an unsafe cast (like to_list below) fails.

val to_list : (t -> 't) -> t -> 't list

This converts a `List (t list) to 't list, or throws a Casting_error in the case that the input is not a `List.

val to_hashtbl : (string -> 'a) -> (t -> 'b) -> t -> ('a, 'b) Stdlib.Hashtbl.t

This converts an `Assoc (string * t list) to ('a, 'b) Hashtbl.t, or throws a Casting_error in the case that the input is not an `Assoc.

val lookup : t -> string -> t option

If t is an `Assoc, this looks up the field specified. If it isn't found, or if the input is not an `Assoc, returns None.