Get Data As a String using Targeted JSON Pointer for Array
ASTER::EXPRESSION::JSON::Targeted JSON Pointer: Retrieve a specific element from the targeted array and obtain the data as a string.
Obtain data as a string from array elements specified by a TgtJSP.
If the data type stored in the array elements is not a string, it will be implicitly cast. For data structures, a dump output without formatting specifications is obtained.
Parameter: Enter array element
Enter the index number of the array element for which you want to retrieve data. The starting index of the array is 0.
3ExStrAsTgtArIdx( "ASTER", 3 )The return value is “Animals”.
Note
Ensure that the data type of the targeted path is an array beforehand.
-
The AsStr command performs implicit conversion of data into a string type.
-
Numbers are converted to strings, and data structures are serialized dumps.
About Targeted JSON Pointer
It's a mechanism similar to browser bookmarks that simplifies path specification.
This document uses the abbreviation
TgtJSP.
Sending long paths with JSON Pointer every time in loop processing is really inefficient.
Since it's the same path, you only need to send it once beforehand and reuse it.
Consider retrieving data from arrays deep within a JSON structure. If you only need to specify indexes to retrieve 10 pieces of data, it might not be zero-emission, but it's very ecological.
Targeted JSON Pointer was designed to reduce the number of path transmissions, lessen the string processing burden related to paths, and streamline data retrieval processes.
- It can only be used with Targeted JSON Pointer compliant commands.