Am trying something very simple with Jolt transformation but struggling to get it to work.
If I have an input like:
{
"id": "54436001"
}
I want output to be:
{
"mediaId" : "54436001",
"events" : {
"mediaId" : "54436001"
}
}
Which is copying a value to two different attributes. I would be tempted to try spec like this to work, but obviously it doesn't because of duplicate key.
[
{
"operation": "shift",
"spec": {
"id": "mediaId",
"id": "events.mediaId"
}
}
]
Is this possible with Jolf transformation?
Yes
Spec
[
{
"operation": "shift",
"spec": {
"id": ["mediaId", "events.mediaId"]
}
}
]
The idea is if you want shift to write a value to two locations in the output, use an array on the right hand side of the spec.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With