I have this inputJson:
[{"firstName": "Kancha", "lastName": "Cheena"},
{"firstName": "Harley", "lastName": "Quinn"}]
Expected output:
[{"fname":"Kancha", "value": "Kancha Cheena"},
{"fname":"Harley", "value": "Harley Quinn"}]
I am using an expression like this:
[*].{fname: firstName, value: firstName lastName}
Can you please suggest correcting this expression?
You can use jmespath expression like
[*].{"fullName":join(``, [firstName, lastName])}
Which gives following result
[
{
"fullName": "KanchaCheena"
},
{
"fullName": "HarleyQuinn"
}
]
First parameter for the join function is the separator