Jsont.Path
JSON paths.
Paths are used for keeping track of encoding and decoding contexts and for specifying queries.
type index =
| Mem of string node
Indexes the value of the member n of an object.
n
| Nth of int node
Indexes the value of the nth element of an array. If negative counts the number of elements from the end: -1 is that last element.
-1
The type for indexing operations on JSON values.
val pp_index : index fmt
pp_index formats indexes.
pp_index
val pp_index_trace : index fmt
pp_index formats indexes and their location.
type t
The type for paths, a sequence of indexing operations.
val root : t
root is the root path.
root
val is_root : t -> bool
is_root p is true iff p is the root path.
is_root p
true
p
val nth : ?meta:Meta.t -> int -> t -> t
nth n p indexes the array indexed by p at index n.
nth n p
val mem : ?meta:Meta.t -> string -> t -> t
mem n p indexes the object indexed by p at member n.
mem n p
val rev_indices : t -> index list
rev_indices p are the indices of p in reverse order.
rev_indices p
val of_string : string -> (t, string) Stdlib.result
of_string s parses a path according to the path syntax.
of_string s
val pp : t fmt
pp formats paths.
pp
val pp_trace : t fmt
pp_path_trace formats paths as a stack trace, if not empty.
pp_path_trace