Reputation: 167
I need to transform (multiple) keys to value and values to keys in JSON using jolt spec. What should be the right spec to do it?
Input :
{
"k1": "v1",
"k2": "v2"
}
Required Output :
{
"v1": "k1",
"v2": "k2"
}
Upvotes: 1
Views: 1908
Reputation: 482
This should reverse key with value:
[
{
"operation": "shift",
"spec": {
"*": {
"$": "@(0)"
}
}
}
]
Upvotes: 3