Procs
proc add(tree: var JsonTree; path: JsonPtr; value: JsonTree) {. ...raises: [UsageError, SyntaxError, PathError], tags: [], forbids: [].}
-
Performs one of the following functions, depending upon what the target location references:
- If path specifies an array index, a new value is inserted into the array at the specified index.
- If path specifies an object member that does not already exist, a new member is added to the object.
- If path specifies an object member that does exist, that member's value is replaced.
value specifies the value to be added.
Source Edit proc copy(tree: var JsonTree; from, path: JsonPtr) {. ...raises: [UsageError, SyntaxError, PathError], tags: [], forbids: [].}
-
Copies the value at a specified location to the target location.
from references the location in tree to copy the value from.
The from location must exist for the operation to be successful.
This operation is functionally identical to an add at the path using the value specified in from.
Source Edit proc move(tree: var JsonTree; from, path: JsonPtr) {. ...raises: [UsageError, SyntaxError, PathError], tags: [], forbids: [].}
-
Removes the value at a specified location and adds it to the target location.
from references the location in the tree to move the value from.
The from location must exist for the operation to be successful.
This operation is functionally identical to a remove operation on from, followed immediately by an add operation at the path with the value that was just removed.
from must not be a proper prefix of the path; i.e., a location cannot be moved into one of its children.
Source Edit proc remove(tree: var JsonTree; path: JsonPtr) {. ...raises: [UsageError, SyntaxError, PathError], tags: [], forbids: [].}
-
Removes the value at the target location.
path must exist for the operation to be successful.
If removing an element from an array, any elements above the specified index are shifted one position to the left.
Source Edit proc replace(tree: var JsonTree; path: JsonPtr; value: JsonTree) {. ...raises: [UsageError, SyntaxError, PathError], tags: [], forbids: [].}
-
Replaces the value at the target location with a new value. value specifies the replacement value.
path must exist for the operation to be successful.
This operation is functionally identical to a remove, followed immediately by an add at the same location with the replacement value.
Source Edit proc test(tree: JsonTree; path: JsonPtr; value: JsonTree): bool {. ...raises: [UsageError, SyntaxError, PathError], tags: [], forbids: [].}
-
Tests that a value at the target location is equal to a specified value.
value conveys the value to be compared to the path's value.
The path's value must be equal to value for the operation to be considered successful.
Source Edit