Methods
append(pointer) → {JsonPointer}
Append all tokens of
Note: The base URI of this pointer will remain untouched
pointer to this pointer Note: The base URI of this pointer will remain untouched
Parameters:
| Name | Type | Description |
|---|---|---|
pointer |
JsonPointer | other pointer |
- Source:
Returns:
a reference to this, so the API can be used fluently
- Type
- JsonPointer
copy() → {JsonPointer}
Copy a JsonPointer
- Source:
Returns:
a copy of this pointer
- Type
- JsonPointer
isLocalPointer() → {boolean}
Return
true if the pointer is local (URI with only fragment)
- Source:
Returns:
- Type
- boolean
isParent(child) → {boolean}
Return
For instance
true if this pointer is a parent pointer of child.
For instance
"/properties" pointer is parent pointer of "/properties/parent"
Parameters:
| Name | Type | Description |
|---|---|---|
child |
JsonPointer |
- Source:
Returns:
- Type
- boolean
isRootPointer() → {boolean}
Return
true if the pointer is a root pointer
- Source:
Returns:
- Type
- boolean
parent() → {JsonPointer}
Remove last reference token of this pointer
- Source:
Returns:
a reference to this, so the API can be used fluently
- Type
- JsonPointer
query(objectToQuery, iterator) → {Object}
Query
If you need to query Vert.x json data structures, use JsonPointer#queryJson
Note: if this pointer is a root pointer, this function returns the provided object
objectToQuery using the provided JsonPointerIterator. If you need to query Vert.x json data structures, use JsonPointer#queryJson
Note: if this pointer is a root pointer, this function returns the provided object
Parameters:
| Name | Type | Description |
|---|---|---|
objectToQuery |
Object | the object to query |
iterator |
JsonPointerIterator | the json pointer iterator that provides the logic to access to the objectToQuery |
- Source:
Returns:
null if pointer points to not existing value, otherwise the requested value
- Type
- Object
queryJson(jsonElement) → {Object}
Query
Note: if this pointer is a root pointer, this function returns the provided json element
jsonElement. Note: if this pointer is a root pointer, this function returns the provided json element
Parameters:
| Name | Type | Description |
|---|---|---|
jsonElement |
Object | the json element to query |
- Source:
Returns:
null if pointer points to not existing value, otherwise the requested value
- Type
- Object
queryJsonOrDefault(jsonElement, defaultValue) → {Object}
Query
Note: if this pointer is a root pointer, this function returns the provided object
jsonElement. If the query result is null, returns the default.Note: if this pointer is a root pointer, this function returns the provided object
Parameters:
| Name | Type | Description |
|---|---|---|
jsonElement |
Object | the json element to query |
defaultValue |
Object | default value if query result is null |
- Source:
Returns:
null if pointer points to not existing value, otherwise the requested value
- Type
- Object
queryOrDefault(objectToQuery, iterator, defaultValue) → {Object}
Query
If you need to query Vert.x json data structures, use JsonPointer#queryJsonOrDefault
Note: if this pointer is a root pointer, this function returns the provided object
objectToQuery using the provided JsonPointerIterator. If the query result is null, returns the default. If you need to query Vert.x json data structures, use JsonPointer#queryJsonOrDefault
Note: if this pointer is a root pointer, this function returns the provided object
Parameters:
| Name | Type | Description |
|---|---|---|
objectToQuery |
Object | the object to query |
iterator |
JsonPointerIterator | the json pointer iterator that provides the logic to access to the objectToQuery |
defaultValue |
Object | default value if query result is null |
- Source:
Returns:
null if pointer points to not existing value, otherwise the requested value
- Type
- Object
toString() → {string}
Build a string representation of the JSON Pointer
- Source:
Returns:
- Type
- string
tracedQuery(objectToQuery, iterator) → {Array.<Object>}
Query
The first element of the list is objectToQuery and the last is the result, or the element before the first null was encountered
objectToQuery tracing each element walked during the query, including the first and the result (if any).The first element of the list is objectToQuery and the last is the result, or the element before the first null was encountered
Parameters:
| Name | Type | Description |
|---|---|---|
objectToQuery |
Object | the object to query |
iterator |
JsonPointerIterator | the json pointer iterator that provides the logic to access to the objectToQuery |
- Source:
Returns:
the stream of walked elements
- Type
- Array.<Object>
write(objectToWrite, iterator, newElement, createOnMissing) → {Object}
Write
If you need to write in Vert.x json data structures, use JsonPointer#writeJson (Object)}
newElement in objectToWrite using this pointer. The path token "-" is handled as append to end of array If you need to write in Vert.x json data structures, use JsonPointer#writeJson (Object)}
Parameters:
| Name | Type | Description |
|---|---|---|
objectToWrite |
Object | object to write |
iterator |
JsonPointerIterator | the json pointer iterator that provides the logic to access to the objectToMutate |
newElement |
Object | object to insert |
createOnMissing |
boolean | create objects when missing a object key or an array index |
- Source:
Returns:
a reference to objectToWrite if the write was completed, a reference to newElement if the pointer is a root pointer, null if the write failed
- Type
- Object
writeJson(jsonElement, newElement, createOnMissing) → {Object}
Write
newElement in jsonElement using this pointer. The path token "-" is handled as append to end of array.
Parameters:
| Name | Type | Description |
|---|---|---|
jsonElement |
Object | json to query and write |
newElement |
Object | json to insert |
createOnMissing |
boolean | create JsonObject when missing a object key or an array index |
- Source:
Returns:
a reference to json if the write was completed, a reference to newElement if the pointer is a root pointer, null if the write failed
- Type
- Object