Jsont.PathJSON paths.
Paths are used for keeping track of erroring contexts and for specifying query and update locations.
val root : troot is the root path.
val is_root : t -> boolis_root p is true iff p is the root path.
rev_indices p are the indices of p in reverse order, the last indexing operation appears first.
val of_string : string -> (t, string) Stdlib.resultof_string s parses a path according to the path syntax.
Path provide a way for end users to address JSON and edit locations.
A path is a sequence of member and list indexing operations. Applying the path to a JSON value leads to either a JSON value, or nothing if one of the indices does not exist, or an error if ones tries to index a non-indexable value.
Here are a few examples of paths.
{
"ocaml": {
"libs": ["jsont", "brr", "cmdliner"]
}
}ocaml.libs # value of member "libs" of member "ocaml"
ocaml.libs.[0] # first element of member "libs" of member "ocaml"More formally a path is a . seperated list of indices. An index is written [i]. i can a zero-based list index. Or i can be an object member name n. If there is no ambiguity, the surrounding brackets can be dropped.
Notes.
[, ], or start with a number.