Reputation: 88
I have to tranform a JSON input to a an array containing one objet.
I have this JOLT configuration:
[
{
"operation": "shift",
"spec": {
"tokenType": "key",
"accessToken": "value"
}
}
]
Here's my input:
{
"tokenType": "Bearer",
"refreshToken": "xxx.xxx.xxx",
"accessToken": "yyy.yyy.yyy",
"signature": "secret",
"links": {
"href": "someLink",
"refreshTokenHref": "someLink",
"signoutHref": "someLink"
},
"version": "1.0"
}
Actual output:
{
"key" : "Bearer",
"value" : "yyy.yyy.yyy"
}
Desired output:
[{
"key" : "Bearer",
"value" : "yyy.yyy.yyy"
}]
Do you have any idea how to do that ?
Thx for your help guys
Upvotes: 1
Views: 52
Reputation: 88
Just found how to do that !
[
{
"operation": "shift",
"spec": {
"accessToken": {
"$": "[#2].key",
"@": "[#2].value"
}
}
}
]
Upvotes: 1