使用Jolt插入当前日期/时间

时间:2018-03-06 20:39:44

标签: json datetime jolt

尝试使用Jolt插入当前日期/时间时需要帮助。

我尝试(如下所示)使用" $ {now()}" ;但是输出没有产生日期/时间。

JSON输入:

[
  {
    "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()}"
      }
    }
}
]

输出:

[ {
  "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()}"
} ]

期望输出:

[ {
  "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"
} ]

我不确定Jolt是否可以接受这些变量。

提前感谢您的任何帮助。

1 个答案:

答案 0 :(得分:1)

开发人员在这里回答。简短的回答是,此时Jolt本身不可能。

Scotty Web server