Jolt JSON Conversion from String value to Long

Viewed 2811

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",
}
1 Answers
Related