You can use the following spec
```json
[
{ // group by LastN/FrstN removed key names
"operation": "shift",
"spec": {
"*": {
"*LastN*": {
"@": "@2,policy.&(1,1)fullna&(1,2)"
},
"*FrstN*": {
"@": "@2,policy.&(1,1)fullna&(1,2)"
}
}
}
},
{ // concatenate the components of the arrays respectively
"operation": "modify-overwrite-beta",
"spec": {
"*": {
"*ful*": "=join(' ',@(1,&))"
}
}
},
{
"operation": "shift",
"spec": {
"*": {
"*": {
"@": "[#2].&",
"$1": "[#2].policy" // deliver back the policy attribute to those objects
}
}
}
}
]
```
It's important to determine the grouping criteria in order to form upcoming objects will depend on
```json
[
{ // group by Last/Frs removed key names
"operation": "shift",
"spec": {
"*": {
"*Last*": {
"@": "@2,policy.&(1,1).&(1,1)fullname" // in &(1,1) : the first 1 represents going 1 level up the tree
// the second 1 represents the replacement for the 1st asterisk
},
"*Frs*": {
"@": "@2,policy.&(1,1).&(1,1)fullname"
}
}
}
},
{ // concatenate the pairs by their key names respectively
"operation": "modify-overwrite-beta",
"spec": {
"*": {
"*": {
"*": "=join(' ',@(1,&))"
}
}
}
},
{
"operation": "shift",
"spec": {
"*": {
"*": {
"*": "[#2].&",
"$1": "[#2].policy" // deliver back the policy attribute to those objects
}
}
}
}
]
```
the ***demo*** on the site http://jolt-demo.appspot.com/ is :
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/6lfax.jpg