Function modifiers
path
Commentary
added in 0.3.21
Retrieves the value in a nested structure, where path
is a sequence of keys. Returns null
if the path is not present.
Examples
Retrieving nested keys
Use a sequence of keys to progressively drill into an object.
{
"_gen": "constant",
"x": {
"a": {
"b": "c"
}
},
"path": [
"a",
"b"
]
}
[
"c"
]
Retrieving in an array
Use indexes, offset from 0
, to drill into an array.
{
"_gen": "constant",
"x": [
"a",
{
"b": [
"c",
"d",
{
"e": "f"
}
]
}
],
"path": [
1,
"b",
2
]
}
[
{
"e": "f"
}
]
Specification
JSON schema
{
"type": "array",
"items": {
"oneOf": [
{
"type": "integer",
"minimum": 0
},
{
"type": "string"
}
]
}
}