i have a json object as in below
{
"_namespace": "kubernetes",
"api_paths": [
{
"api_action": "post",
"api_path": "v1/ldap",
"api_payload": {
"policies": [
"reader",
"writer",
"encrypt",
"decrypt"
]
}
}
]
}
i am expecting an outcome like below
{
"_namespace": "kubernetes",
"api_paths": [
{
"api_action": "post",
"api_path": "v1/ldap",
"api_payload": {
"policies": [
"reader",
"writer",
"encrypt",
"decrypt",
"delete"
]
}
}
]
}
can someone help me to correct the expression
$ ~> | {
"api_paths": $map(function($path) {
if ($path.api_path["v1/ldap"]) {
return $merge([$path, {
"api_payload": $merge([$path.api_payload, {
"policies": $append(api_payload.policies, "delete")
}])
}])
} else {
return $path
}
})
}
getting error Expected ":", got "merge"
can someone help me to understand what shall be done to fix this.