Something went wrong. Try again.
JSON Pointer token syntax (RFC 6901)
Something went wrong. Try again.
Files
README.md
nox-jsonptr #
The JSON Pointer string syntax of RFC 6901.
A JSON Pointer such as /a~1b/0 names one value inside a JSON document, and
the same syntax addresses values in YAML. The traversal differs with the
value type, but the string rules do not: ~ and / inside a token are
escaped as ~0 and ~1, and an array index is a decimal number without a
leading zero. nox-jsonptr implements those string rules only, so a JSON or
YAML cursor can share them and walk its own values.
Installation #
Install with opam:
$ opam install nox-jsonptr
If opam cannot find the package, it may not yet be released in the public
opam-repository. Add the overlay repository, then install it:
$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install nox-jsonptr
Usage #
# Jsonptr.tokens "/a~1b/0";;
- : string list option = Some ["a/b"; "0"]
# Jsonptr.encode_token "m~n";;
- : string = "m~0n"
# Jsonptr.decode_index "01";;
- : int option = None
License #
ISC.