package json-pointer

  1. Overview
  2. Docs
RFC 6901 JSON Pointer implementation for jsont

Install

dune-project
 Dependency

Authors

Maintainers

Sources

json-pointer-1.0.tbz
md5=154a8d5caa45d40535d97108bea3a683
sha512=88a34ef7ec9ddb3f88009a7ac854e2e92be5a376a14c1a760a7bddd8e867723b22fee0ae417a29e4a502110d4bd0f28ea669160220f57df48bfb47cfe1af9b6b

doc/json-pointer.top/Json_pointer_top/index.html

Module Json_pointer_topSource

Toplevel printers for Json_pointer, Jsont.json, and Jsont.Error.t.

Printers are automatically installed when the library is loaded:

# #require "json-pointer.top";;

After loading, JSON Pointers display in their string representation:

  # Json_pointer.of_string "/foo/0";;
  - : Json_pointer.t = "/foo/0"

JSON values will display as formatted JSON strings:

  # Jsont.Json.list [Jsont.Json.int 1; Jsont.Json.int 2];;
  - : Jsont.json = [1, 2]

And errors will display as readable messages:

  # Json_pointer.of_string "invalid";;
  Exception: Jsont.Error: Invalid JSON Pointer: must be empty or start with '/'
Sourceval pointer_printer : Format.formatter -> Json_pointer.t -> unit

pointer_printer formats a JSON Pointer in its string representation. Suitable for use with #install_printer.

Sourceval json_printer : Format.formatter -> Jsont.json -> unit

json_printer formats a Jsont.json value as a human-readable JSON string. Suitable for use with #install_printer.

Sourceval error_printer : Format.formatter -> Jsont.Error.t -> unit

error_printer formats a Jsont.Error.t as a human-readable error message. Suitable for use with #install_printer.

Sourceval install : unit -> unit

install () installs all printers. This is called automatically when the library is loaded, but can be called again if needed (e.g., in test environments where automatic initialization doesn't run).