I am using Jolt to convert one json to another json. Everything is working fine except I want to convert String value to Long. Below is my Specs and input. I have use modify-overwrite-beta but no luck.
Specs -
[
{
"operation": "modify-overwrite-beta",
"spec": {
"timestamp": "=toLong(@(1,time))"
}
},
{
"operation": "shift",
"spec": {
"key1": "outputText1",
"key2": "outputText2",
"key3": "outputText3",
"time": "timestamp"
}
}
]
Input Json
{
"key1": "test1",
"time": "1499967627",
"key2": "test2",
"key3": "test3",
}
So in above input json how I can convert time value to Long
Expected Json :
{
"outputText1": "test1",
"timestamp": 1499967627,
"outputText2": "test2",
"outputText3": "test3",
}
Spec
[
{
"operation": "modify-overwrite-beta",
"spec": {
"timestamp": "=toLong(@(1,time))"
}
},
{
"operation": "shift",
"spec": {
"key1": "outputText1",
"key2": "outputText2",
"key3": "outputText3",
// pass timestamp thru
"timestamp": "timestamp"
}
}
]
In the first operation (modify) it was making "timestamp" be a long. But then in the 2nd operation, you were copying the String value from "time" to timestamp, instead of passing timestamp thru.
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