JSONPATH
Process Json formatted data.
WebVue support - Yes.
Mode |
Mnemonic |
Syntax |
1 | GET | 1 |
2 | GETSTR | 2 |
3 | GETDOUBLE | 3 |
4 | GETSINGLE | 4 |
5 | GETLONG | 5 |
6 | GETINT | 6 |
7 | GETBOOL | 7 |
8 | LOAD | 8 |
9 | UNLOAD | 9 |
10 | LOADFILE | 10 |
Arguments common to more than one mode
Argument |
Meaning |
Namespace |
The identifier of the Json fragment used as input. Type STR or LONG. |
JsonPath |
The name of a Json key under the form of a Json path. Type STR or LONG. |
Syntax 1
LongVal = JsonPath(Mode, Namespace, JsonPath);
Return type: LONG.
Execution
Mode |
Mnemonic |
Action |
1 |
GET |
Returns a handle for the JsonPath key in Namespace. |
LongVal is automatically allocated and reallocated if the verb is called cyclically. There is no need to do any allocation via ALLOC_BUFFER. There is no limit in buffer size, so we recommend the project designer to be careful when handling large Json fragments as it can require a large amount of memory.
The LongVal handle is finally de-allocated when the UNLOAD mode is called.
Syntax 2
StrVal = JsonPath(Mode, Namespace, JsonPath);
Return type: STR.
Execution
Mode |
Mnemonic |
Action |
2 |
GETSTR |
Returns the string value of the JsonPath key from the Namespace. |
Syntax 3
DoubleVal = JsonPath(Mode, Namespace, JsonPath);
Return type: DOUBLE.
Execution
Mode |
Mnemonic |
Action |
3 |
GETDOUBLE |
Returns the double value of the JsonPath key from the Namespace. |
Syntax 4
SingleVal = JsonPath(Mode,Namespace, JsonPath);
Return type: SINGLE.
Execution
Mode |
Mnemonic |
Action |
4 |
GETSINGLE |
Returns the single value of the JsonPath key from the Namespace. |
Syntax 5
LongVal = JsonPath(Mode, Namespace, JsonPath);
Return type: LONG.
Execution
Mode |
Mnemonic |
Action |
5 |
GETLONG |
Returns the long value of the JsonPath key from the Namespace. |
Syntax 6
IntVal = JsonPath(Mode,Namespace, JsonPath);
Return type: INTEGER.
Execution
Mode |
Mnemonic |
Action |
6 |
GETINT |
Returns the integer value of the JsonPath key from the Namespace. |
Syntax 7
IntVal = JsonPath(Mode, Namespace, JsonPath);
Return type: INTEGER.
Execution
Mode |
Mnemonic |
Action |
7 |
GETBOOL |
Returns the boolean value (as an integer) of the JsonPath key from the Namespace.
|
Syntax 8
IntVal = JsonPath(Mode, Namespace, JsonData);
Return type: INTEGER.
Argument |
Meaning |
JsonData |
A Json formatted string. Type STR. Or a handle to a buffer containing a Json formatted string. Type LONG. |
Execution
Mode |
Mnemonic |
Action |
8 |
LOAD |
Load and map a Json fragment, from a string, to the specified Namespace. Return: 1 if successful, -1 if a Json parsing error occurred. |
Syntax 9
IntVal = JsonPath(Mode, Namespace);
Return type: INTEGER.
Execution
Mode |
Mnemonic |
Action |
9 |
UNLOAD |
Unload and unmap the Json fragment from the specified Namespace. Return: Always 0. |
Syntax 10
IntVal = JsonPath(Mode, Namespace, JsonFilename);
Return type: INTEGER.
Argument |
Meaning |
JsonFilename | The name of the Json file to load. Type STR or LONG. |
Execution
Mode |
Mnemonic |
Action |
10 |
LOADFILE |
Load and map a Json fragment, from a file, to the specified Namespace. Return: 1 if successful, -1 if a Json parsing error occurred, -2 if file not found. If executed in a WebVue session context this instruction is processed by the computer that hosts the web back end and the referenced file is on that computer. |
Example
For an example, select the Examples link above.