NiFi 中的颠簸变换

Jolt Transform in NiFi

我正在将 Jolt 应用于 NiFi,但没有得到预期的结果。

结果

{
   "from": "2020-07-16T18:14:00+00:00",
   "to": "2020-07-16T18:15:00+00:00",
   "values":
   {
       "score": 1.0,
       "s": 0,
       "t": 0,
       "f": 0,
       "count": 0,
       "value": null,
       "threshold": 0.5,
       "threshold_min": 0.5
   },
   "aplication": "Magento",
   "name": "ApdexAll"
}

颠簸

  [{
        "operation": "shift",
        "spec": {
            "*": "&"
        }
    }, {
        "operation": "default",
        "spec": {
            "aplication": "${aplication}",
            "name": "${name}"
        }
    }]

我需要一个只有一级的json

{
    "aplication": "Magento",
    "name": "ApdexAll",
    "from": "2020-07-16T18:14:00+00:00",
    "to": "2020-07-16T18:15:00+00:00",
    "values":
    {
        "score": 1.0,
        "s": 0,
        "t": 0,
        "f": 0,
        "count": 0,
        "value": null,
        "threshold": 0.5,
        "threshold_min": 0.5
    }
}

“仅一级”是指将值中的属性添加到 json?

的根

如果是这种情况,规格将是:

[{
  "operation": "shift",
  "spec": {
    "*": "&",
    "values": {
      "*": "&"
    }
  }
    }, {
  "operation": "default",
  "spec": {
    "aplication": "${aplication}",
    "name": "${name}"
  }
    }]

你会得到这样的输出:

{
  "from" : "2020-07-16T18:14:00+00:00",
  "to" : "2020-07-16T18:15:00+00:00",
  "score" : 1,
  "s" : 0,
  "t" : 0,
  "f" : 0,
  "count" : 0,
  "value" : null,
  "threshold" : 0.5,
  "threshold_min" : 0.5,
  "aplication" : "magento",
  "name" : "ApdexAll"
}