|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > JSON - Parser > PSJ. - JSON Operations |
PSJ. Command Foundation: Tested Features |
Top |
SPR Script Language
PSJ. Command Foundation: Tested Features & Capabilities
An overview of the core functionalities implemented and verified within the underlying JSW library, powering the PSJ commands.
Intention
The PSJ commands provide a user-friendly interface to the powerful JSW library. This page summarizes the broad range of features that have been implemented within the JSW library, demonstrating its maturity and comprehensive capabilities. While not a formal test report, this list details the functionalities verified through implementation and internal testing, giving you confidence in the reliability and scope of the PSJ command set for your scripting needs.
Verified Feature Areas:
ü Robust Parsing & Loading: Create document handles from valid JSON strings or files. Automatic encoding detection (UTF-8/UTF-16LE/UTF-16BE BOMs) ensures broad compatibility. Handles all standard JSON data types and structures.
ü Accurate Unicode String Handling: Correctly parses and serializes JSON escape sequences, including standard codes (\n, \t, etc.), `\uXXXX` for BMP characters, and complex UTF-16 surrogate pairs, ensuring full Unicode support.
ü High-Performance Object Management: Leverages the WsLnTre B-Tree library for storing object members, providing fast key lookups, retrievals, and deletions, especially beneficial for large objects.
ü Flexible Path Navigation: Supports both Dot/Bracket notation and JSON Pointer syntax for accessing nodes. Includes path caching for improved performance on repeated lookups.
ü Node Creation & Type Enforcement: Automatically create missing nodes along a path (`PSJ.GetByPath` with create flag, `PSJ.Ensure*`) and ensure nodes are of the required type (`PSJ.SetArrByPath`, `PSJ.SetObjByPath`).
ü Comprehensive Value Operations:Reliably get, set, check for null, append, and remove primitive values within arrays and objects.
ü Deep Copy & Merging: Create complete, independent duplicates of documents or subtrees (`PSJ.DupDoc`, `PSJ.DupTree`). Merge contents of arrays, objects, or entire documents (`PSJ.Merge*`).
ü Versatile Serialization: Convert documents or specific nodes back into JSON strings (`PSJ.ToString`, `PSJ.NodeToStr`), with options for compact or pretty-printed output.
ü Structure Integrity Tools: Perform basic document validation (`PSJ.Validate`) and check for / remove orphaned nodes (`PSJ.Repair`).
ü Convenience Extraction: Quickly parse and extract specific data points from JSON text using the one-shot PSJ.Extract* commands, streamlining common tasks like processing API responses.
Conclusion
The PSJ command set, backed by the thoroughly implemented JSW library, provides a stable, efficient, and feature-rich solution for handling JSON data within the SPR Scripting environment. Explore the individual command pages for detailed usage and examples.
See also:
• PSJ. - JSON Operations Overview (WsLnTre)
• Understanding JSON Paths in PSJ.