package rdf_json_ld

  1. Overview
  2. Docs

JSON documents.

type loc = int * int

1-based line * 0-based column

type range = loc * loc
val string_of_range : range -> string
type 'a ranged = {
  1. loc : range option;
  2. data : 'a;
}
val ranged : ?loc:range -> 'a -> 'a ranged
type error = ..
type error +=
  1. | Invalid_json of string
exception Error of error
val error : error -> 'a

error e raises Error e.

type key = string ranged
type map = (key * json) list
and json_t = [
  1. | `Obj of map
  2. | `List of json list
  3. | `String of string
  4. | `Bool of bool
  5. | `Float of float
  6. | `Null
]
and json = json_t ranged
val json : ?loc:range -> json_t -> json
val string_of_error : range -> Jsonm.error -> string
val from_string : ?encoding:[< Jsonm.encoding ] -> string -> (json, range * Jsonm.error) Stdlib.result
val from_string_exn : ?encoding:[< Jsonm.encoding ] -> string -> json
val to_string : ?minify:bool -> json -> string

to_string json returns the given json in JSON syntax. Optional argument minify (default false) indicates whether to minify the output.

val pp : Stdlib.Format.formatter -> json -> unit

pp ppf json pretty-prints json to ppf.

val ppm : Stdlib.Format.formatter -> json -> unit

Same as pp but pretty-prints minified JSON.

val string : ?loc:range -> string -> json
val string_of_opt : ?loc:range -> string option -> json
val list : ?loc:range -> json list -> json
val obj : ?loc:range -> map -> json
val null : json
val bool : ?loc:range -> bool -> json
val float : ?loc:range -> float -> json
val compare : json -> json -> int
val key_value_compare : (key * json) -> (key * json) -> int
val map_compare : map -> map -> int
val sort_map : map -> map
val normalize : json -> json
val equal : json -> json -> bool
val to_array : json -> json
val values : json -> json list
val is_scalar : json -> bool
val is_string_array : json -> bool
val string_of_json_opt : json option -> string
val map_get : map -> string -> json option
val map_add_value : map -> string -> json -> map
val map_remove_value : map -> string -> map
val map_pp : Stdlib.Format.formatter -> map -> unit
val opt_map_pp : Stdlib.Format.formatter -> map option -> unit
val (-->>) : map -> string -> json option
val (-->) : map -> string -> json_t option
val (-?>) : json -> string -> json option
OCaml

Innovation. Community. Security.