A JSON pointer (RFC 6901) refers to a possible element in a JSON data structure.
The element referenced by the pointer may or may not exist.
Given the JSON:
{
"foo": {
"bar": 1,
"baz": true
},
"bat": [0, 1, 2]
}
The JSON pointers for each element are:
- ""
- "/foo"
- "/foo/bar"
- "/foo/baz"
- "/bat"
- "/bat/0"
- "/bat/1"
- "/bat/2"
Public Member Functions |
| JsonPointer (const JsonPointer &other) |
| JsonPointer (const std::string &path) |
| Construct a new JsonPointer from a string representing the path.
|
bool | operator== (const JsonPointer &other) const |
| Equality operator.
|
bool | IsValid () const |
| Returns true if this pointer is valid.
|
Iterator | begin () const |
| Return an iterator pointing to the first token in the JsonPointer.
|
unsigned int | TokenCount () const |
| The number of tokens in the Json Pointer.
|
std::string | TokenAt (unsigned int i) const |
| Return the token at the specifed index.
|
void | Push (const std::string &token) |
| Append a token to the pointer path.
|
void | Pop () |
| Pop the last token from the pointer.
|
std::string | ToString () const |
| Returns the string representation of the pointer.
|
bool | IsPrefixOf (const JsonPointer &other) const |
| Check if this pointer is a prefix of another.
|