0

Need assistance on trying to insert the current date/time using Jolt.

I tried (as shown below) using "${now()}"; but the output is not producing the date/time.

JSON input:

[
  {
    "ProdId": "Filler",
    "ProductName": "Z Dry Filler",
    "Trait": "",
    "Variety": "",
    "SuggestedRetailPrice": "0.0000",
    "CropId": "",
    "DeptId": "067001"
  },
  {
    "ProdId": "Clay",
    "ProductName": "Z Clay",
    "Trait": "",
    "Variety": "",
    "SuggestedRetailPrice": "0.0000",
    "CropId": "",
    "DeptId": "067001"
  }
]

Jolt Spec:

[
  {
    "operation": "default",
    "spec": {
      "*": {
        "LastUpdated": "${now()}"
      }
    }
}
]

Output:

[ {
  "ProdId" : "Filler",
  "ProductName" : "Z Dry Filler",
  "Trait" : "",
  "Variety" : "",
  "SuggestedRetailPrice" : "0.0000",
  "CropId" : "",
  "DeptId" : "067001",
  "LastUpdated" : "${now()}"
}, {
  "ProdId" : "Clay",
  "ProductName" : "Z Clay",
  "Trait" : "",
  "Variety" : "",
  "SuggestedRetailPrice" : "0.0000",
  "CropId" : "",
  "DeptId" : "067001",
  "LastUpdated" : "${now()}"
} ]

Desired Output:

[ {
  "ProdId" : "Filler",
  "ProductName" : "Z Dry Filler",
  "Trait" : "",
  "Variety" : "",
  "SuggestedRetailPrice" : "0.0000",
  "CropId" : "",
  "DeptId" : "067001",
  "LastUpdated" : "2018-03-06T15:38:19Z"
}, {
  "ProdId" : "Clay",
  "ProductName" : "Z Clay",
  "Trait" : "",
  "Variety" : "",
  "SuggestedRetailPrice" : "0.0000",
  "CropId" : "",
  "DeptId" : "067001",
  "LastUpdated" : "2018-03-06T15:38:19Z"
} ]

I'm not sure Jolt can even accept such variables.

Thanks in advance for any assistance.

Jason Gregory
  • 139
  • 1
  • 16

1 Answers1

1

The developer answered here. Short answer is that it is not natively possible in Jolt at this time.

https://github.com/bazaarvoice/jolt/issues/531#issuecomment-370956891

Jason Gregory
  • 139
  • 1
  • 16