Skip to main content

$$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​

ArgumentTypeValuesRequired / Default ValueDescription
PrimaryanyYesObject to query
opEnumGET / SET / REMOVEYesOperation
pointerstringJSON Pointer as defined by RFC-6901YesJSON Pointer to apply operation on
valueanyValue 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"