Json_pointer_topSourceToplevel 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 '/'pointer_printer formats a JSON Pointer in its string representation. Suitable for use with #install_printer.
json_printer formats a Jsont.json value as a human-readable JSON string. Suitable for use with #install_printer.
error_printer formats a Jsont.Error.t as a human-readable error message. Suitable for use with #install_printer.
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).