Overwrite with Sequential Numbers (Dedicated 2D Array)
using JSON Pointer..
ASTER::ACTION::JSON::Overwrite 2D Array Elements with Sequential Numbers.
Assign “Sequential Numbering” to the specified elements in a two-dimensional array.
-
This is a JSON data editing function dedicated to two-dimensional arrays.
-
This overwrite command does not perform type checking in advance.
-
Please note that the data type of the path-specified value will be forcibly overwritten to a numeric type.
Function Overview
Perform loop processing that narrows down the range of array elements in the path-specified JSON array and assigns sequential numbers to the array elements.
Parameter.1
Specify JSON Pointer
Assume the following JSON data is loaded in memory as a sample.
{
"test":[
[true, -1],
[true, -1],
[true, -1]
]
}"/test" is a two-dimensional array. As a sample parameter, the following:
"/test/0/1"
"test" is a two-dimensional array. If the type does not match, an error notification is displayed, the process is interrupted, and the command execution ends.
Type checking is performed as follows.
/test/0 <!-- is an array -->
/test/0/true
/test/0/-1
/test/1 <!-- is an array = ( here it is determined as a two-dimensional array ) -->
/test/1/true
/test/1/-1
/test/2 <!-- no further type checking -->
/test/2/true
/test/2/-1Parameter.1 requires a description that includes specifying array elements.
This array element specifies the starting position for the loop processing execution.
"/test/0/1"specifies that the array element to be processed in the loop starts from0.
Here, we will temporarily skip the explanation of Parameter.2 and first show the result of rewriting using the above parameter.
Parameter.2 sets the loop processing configurations.
Parameter.2
Serialize multiple “integer” data into a single parameter and send it to
ASTER.
Format checking is enabled; if invalid data is entered, a format error is displayed. If a format error occurs, all processing is interrupted, and the command is terminated.
As a sample where "/test" is a two-dimensional array containing 3 array types and the number of loop processing is specified as 3, the following:
" 3 , 1 , +1 "| param | Type | Description |
|---|---|---|
| 3 | unsigned int | Number of loop iterations (negative values are errors) |
| 1 | int | Starting number for sequential numbering |
| +1 | int | Increment/decrement value for sequential numbering: use of sign for readability is recommended |
Set the number of loop iterations and the starting number and increment/decrement value for sequential numbering. Parameter.1 specifies the loop start position, and the loop iteration count in Parameter.2 adjusts the loop end position.
Here is the execution result using the sample Parameter.1 and the current Parameter.2:
{
"test":[
[true, 1],
[true, 2],
[true, 3]
]
}Example of Format Error
Remarks.1
Type Check
Remarks.2
Plus-Minus Sign
Remarks.3
Loop Start Position and Loop End Position
Loop Count Specification