$$jsonpointer
Apply mutations on object paths using JSON Pointer (defined by RFC-6901)
Usage​
"$$jsonpointer(<op>,<pointer>,[value]):{input}"
{
"$$jsonpointer": /* value */,
"op": /* GET / SET / REMOVE */,
"pointer": /* JSON Pointer string */,
"value": /* value for SET */
}
Returns​
Depends on the expression
Arguments​
Argument | Type | Values | Required / Default Value | Description |
---|---|---|---|---|
Primary | any | Yes | Object to query | |
op | Enum | GET / SET / REMOVE | Yes | Operation |
pointer | string | JSON Pointer as defined by RFC-6901 | Yes | JSON Pointer to apply operation on |
value | any | Value to use (when operation is SET ) |
Examples​
Input
Definition
Output
{
"b": [
"c",
"d",
{
"e": "Hello"
}
]
}
"$$jsonpointer(GET,/b/2/e):$"
"Hello"
{
"b": [
"c",
"d",
{
"e": "Hello"
}
]
}
"$$jsonpointer(SET,/b,'$.b[2]'):$"
{
"b": {
"e": "Hello"
}
}
{
"b": [
"c",
"d",
{
"e": "Hello"
}
]
}
"$$jsonpointer(REMOVE,/b/2):$"
{
"b": [
"c",
"d"
]
}
{
"pointer": "/pointer"
}
"$$jsonpointer(GET,$.pointer):$"
"/pointer"