PSJ. - JSON Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > JSON - Parser > Parser-Operations >

PSJ. - JSON Operations

Utility and Conversion

Top


SPR Script Language

 

Utility and Conversion

Commands for utility functions and data conversion in the SPR Script Language.

 

Intention

 

The Utility and Conversion chapter groups commands in the PSJ. library that provide supporting utility functions and data conversion capabilities for JSON processing. These commands handle tasks such as removing duplicate keys, extracting keys, serializing nodes, searching, and converting JSON to strings. This section is intended for users who need auxiliary tools to enhance their JSON manipulation workflows.

 

For example, converting a JSON document to a string or searching for nodes by key-value pairs can be achieved using these commands, improving flexibility in JSON handling.

 

Illustration

📝 Convert to String: PSJ.ToString|docHandle|$$STR converts the specified document to a string and stores it in $$STR.
📝 Search Nodes: PSJ.Search|docHandle|key|value|$$RESULT searches for nodes by key-value pair and stores the result in $$RESULT.

 

Commands

 

PSJ.Dedup - Removes duplicate keys from a JSON object.

PSJ.ErrCode - Retrieves the last error code from a JSON operation.

PSJ.ErrMsg - Retrieves the last error message from a JSON operation.

PSJ.Key - Extracts a JSON key from a text string.

PSJ.NodeToStr - Serializes a node to a string representation.

PSJ.ParseArr - Parses a JSON array from text and creates a node.

PSJ.Search - Searches for nodes by key-value pairs within a document.

PSJ.ToString - Converts an entire JSON document to a string.

 

Remarks

 

- All utility and conversion operations require a valid document handle where applicable.

- Commands like PSJ.Dedup and PSJ.Search provide additional functionality, while PSJ.ToString and PSJ.NodeToStr handle conversion tasks.

 

See also:

 

Array Operations

Object Operations

Node Operations

Value Operations

Document Operations

File I/O