I want to know how to use shift and modify-overwrite-beta for the below input. Please explain how it works with your answer.
Input:
[
{
"data": {
"firstName": "Leanne",
"lastName": "Graham",
"id": 111
}
},
{
"data": {
"firstName": "Ervin",
"lastName": "Howell",
"id": 222
}
}
]
Desired output:
{
"111": {
"fullName": "Leanne Graham"
},
"222": {
"fullName": "Ervin Howell"
}
}
2
Answers
You can solve that in different ways.
1. This spec is more understandable:
id
value as a key in theshift
operation:@(1,id)
firstName
andlastName
in themodify-overwrite-beta
operation:=concat(@(1,firstName),' ',@(1,lastName))
remove
operation:id, firstName, lastName
2. This spec is shorter:
firstName
andlastName
in themodify-overwrite-beta
operation:=concat(@(1,firstName),' ',@(1,lastName))
id
as a key and putfullname
in it: key@(1,id).fullName
, value@(0,fullName)
The following image can help more:
You can use those consecutive transformation specs
as the names suggest shift is used to move the attributes/arrays/objects to their new places, and modify updates on the existing structure