SingleJsonPathBuilder
Builder for generating a JSON path expression to a single JSON subtree or child.
Note that this class is a very rudimentary builder. There are a lot more restrictions when using this class, including:
initialPath
of the constructor must either by empty or starts with '$'.All child elements are appended using the dot syntax (
.child
).All array indices are appended using the array subscript syntax (
[]
).
On the other hand, this class will not attempt to verify the correctness of the JSON Path expression.
It is recommended to provide no arguments to the constructor if trying to build a new JSON Path. Passing a string to the constructor is only recommended if you need to append to an existing JSON Path.
Throws
if initialPath
does not start with $
.
Functions
Appends an array index to the JSON path.
Appends a child element to the JSON path.