Create New Array (Empty | Data Auto Fill)


using JSON Pointer..

ASTER::ACTION::JSON::Create A New Array: Data Auto Fill Option

An array is created at the path specified by the JSON Pointer.

  • It is a function that creates a new array for data expanded in memory.

  • An option is available to insert data into array elements when creating the array.

In the absence of preloaded JSON data, read more…

If there is no pre-loaded data, create a new JSON Object at the root and add an array.

In that case, specify the JSON Pointer directly under the root. The following description is possible:

"/NewArray"

The following description will result in an error:

"/test/NewArray"

/NewArray is known to be an array, but /test is a data structure, so it cannot be inferred whether it is an array or an object.


Parameter.1

JSON Pointer: Specify the insertion position of the array-type data.

If the key name is duplicated, it will be overwritten.

Create an array under the root with the key name "test", example of JSON Pointer:

"/test"

Parameter.2

Array element count

The number of times to add elements to the end of the array and the number of times to insert data = specify the array element count.

As an example of parameters when inserting 3 data items into the array,

3

Parameter.3

Specifying the Data Type to be Inserted

0

When a value of 0 is given, data is not inserted at the end of the array element. The specification of Parameter.2 is disabled.

The data type to be inserted can be selected from 2 types of primitive types and data structure types.

There is a dedicated command for Boolean.

Number Data Type Detail
0 None Ignores the specification of Parameter.2.
1 Numeric Sequential numbers starting from 0 are automatically assigned.
2 String An empty string "" is automatically assigned.
3 Array No initial value, becomes a two-dimensional array.
4 Object The initial value {"key":0} is assigned. The numeric type corresponding to the key name is sequential.

Below are examples of settings and their results for Parameter.3 in relation to Parameter.1 and Parameter.2.

{
    "test":[]
}
{
    "test":[
        0,
        1,
        2
    ]
}
{
    "test":[
        "",
        "",
        ""
    ]
}
{
    "test":[
        [],
        [],
        []
    ]
}
{
    "test":[
        {"key":0},
        {"key":1},
        {"key":2}
    ]
}