|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > JSON - Parser > Parser-Operations > PSJ. - JSON Operations |
SPR Script Language
Array Operations
Commands for manipulating JSON arrays within the SPR Script Language.
Intention
The Array Operations chapter groups commands in the PSJ. library that are specifically designed to manipulate JSON arrays. These commands allow users to append values, determine array length, remove elements, and merge arrays, providing a comprehensive set of tools for array management within JSON documents. This section is intended for users who need to work with ordered collections of data in their JSON structures.
For example, appending a number to an array or merging two arrays can be accomplished using these commands, making it easier to build or modify array-based data in a JSON document.
Illustration
📝 Append a Boolean: PSJ.AppendBool|docHandle|arrayHandle|true adds a true value to the specified array.
📝 Get Array Length: PSJ.ArrLen|docHandle|arrayHandle|$$LEN retrieves the length of the array and stores it in $$LEN.
Commands
• PSJ.AppendBool - Appends a boolean value (true or false) to a JSON array.
• PSJ.AppendNull - Appends a null value to a JSON array.
• PSJ.AppendNum - Appends a numeric value (integer or decimal) to a JSON array.
• PSJ.AppendStr - Appends a string value to a JSON array.
• PSJ.ArrLen - Retrieves the length of a JSON array and stores it in a variable.
• PSJ.DelElem - Removes an element from a JSON array at a specified index.
• PSJ.MergeArr - Merges two JSON arrays into a single array.
Remarks
- All array operations require a valid document handle and array node identifier.
- Commands like PSJ.AppendBool and PSJ.AppendNum allow dynamic addition of elements, while PSJ.DelElem supports removal by index.
See also: