PSJ. - JSON Operations

<< Click to Display Table of Contents >>

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

PSJ. - JSON Operations

Value Operations

TopNext


SPR Script Language

 

Value Operations

Commands for manipulating and retrieving JSON values in the SPR Script Language.

 

Intention

 

The Value Operations chapter groups commands in the PSJ. library that are designed to manipulate and retrieve specific values within JSON documents. These commands enable users to get or set values of various types (boolean, number, string, null) at specified paths, as well as parse values from text. This section is intended for users who need to handle individual data elements in their JSON structures.

 

For example, setting a boolean value at a specific path or parsing a number from text can be accomplished using these commands, enabling precise value management in a JSON document.

 

Illustration

📝 Set a String: PSJ.SetStr|docHandle|path|HelloWorld sets the string "HelloWorld" at the specified path.
📝 Get a Number: PSJ.GetNum|docHandle|path|$$NUM retrieves a numeric value from the specified path and stores it in $$NUM.

 

Commands

 

PSJ.GetBool - Retrieves a boolean value from a specified JSON path.

PSJ.GetNum - Retrieves a numeric value from a specified JSON path.

PSJ.GetStr - Retrieves a string value from a specified JSON path.

PSJ.GetValStr - Retrieves a value as a string from a specified JSON path.

PSJ.ParseBool - Parses a boolean value from text and creates a node.

PSJ.ParseNum - Parses a numeric value from text and creates a node.

PSJ.ParseVal - Parses a value of any type from text and creates a node.

PSJ.SetBool - Sets a boolean value at a specified JSON path.

PSJ.SetNull - Sets a null value at a specified JSON path.

PSJ.SetNum - Sets a numeric value at a specified JSON path.

PSJ.SetStr - Sets a string value at a specified JSON path.

PSJ.SetVal - Sets a value with an explicit type at a specified JSON path.

 

Remarks

 

- All value operations require a valid document handle and a well-formed path.

- Commands like PSJ.GetBool and PSJ.SetNum handle specific types, while PSJ.SetVal offers flexibility with explicit type specification.

 

See also:

 

Array Operations

Object Operations

Node Operations