-
Notifications
You must be signed in to change notification settings - Fork 0
$ref (reference)
0xMaxLab edited this page Mar 15, 2026
·
3 revisions
The reference command is one of the core commands which is the reason why RichJSON became so highly modular in the first place and also the origin of every other command that followed after. It is very important to get this command right, but no pressure, it is very straight forward.
mem: { "key": "$ref:<path>" }
key: no implementation
path: Define the path to a member like this 'my/path/to/member', the path needs to be absolut starting from current root.
{ // <-- root
"some_object": {
"some_array": [ 0, 1, 2, 3 ],
"some_string": "hi I am a string:)"
},
// in the above line the `$ref` command is going reference the member `some_array` of the object 'some_object'
"ref_array": "$ref:some_object/some_array",
"ref_string": "$ref:some_object/some_string",
"ref_object": "$ref:some_object"
}Note
The term reference here depends on the data type.
Depending on the type, the given member may or may not be truly referenced.
{
"some_object": {
"some_array": [ 0, 1, 2, 3 ],
"some_string": "hi I am a string:)"
},
"ref_array": [ 0, 1, 2, 3 ], // "$ref:some_object/some_array"
"ref_string": "hi I am a string:)", // "$ref:some_object/some_string"
"ref_object": { // "$ref:some_object"
"some_array": [ 0, 1, 2, 3 ],
"some_string": "hi I am a string:)"
}
}Author’s Recommendation: next read $env
Back to Repo ● Wiki Home
Copyright © Maximilian Schwarz