Skip to content

Array Access

Grisgram edited this page Oct 3, 2025 · 7 revisions

Description

Since JSON structures also consist of arrays,
RichJson allows you to directly reference elements of arrays as well.

Syntax

reference path: my/path/to/some_3d_array[2][0][4]

Example

Before Applyment

{ // <-- root
    "some_array": [
        {
             "some_array": [ [ 0, 1 ], [ 2, 3] ]
        }
    ],
    "ref_array": "#ref:some_array[0]",
    "ref_array1": "#ref:some_array[0]|some_array[0][0]",
    "ref_array2": "#ref:some_array[0]|some_array[1][0]",
}

After Applyment

{
    "some_array": [
        {
             "some_array": [ [ 0, 1 ], [ 2, 3] ]
        }
    ],
    "ref_array": {                                 // "#ref:some_array[0]"
        "some_array": [ [ 0, 1 ], [ 2, 3] ]
    },
    "ref_array1": 0                                // "#ref:some_array[0]|some_array[0][0]",
    "ref_array2": 2                                // "#ref:some_array[0]|some_array[1][0]",
}

Author’s Recommendation: next read String Interpolation

Clone this wiki locally