【问题标题】:NIFI - Jolt Specification - ConcatenateNIFI - 颠簸规范 - 连接
【发布时间】:2020-12-18 19:58:57
【问题描述】:

我正在尝试连接两个字符串。由于字符串名称包含.,因此不会在 concat 表达式中读取该特定字段。

json 输入:

{
  "properties": [
    {
      "test.flu": "flu1",
      "reportId": 11
    },
    {
      "test.flu": "flu2",
      "reportId": 12
    }
  ],
  "type": "node",
  "labels": "label1"
}

颠簸规格:

[
  {
    "operation": "modify-default-beta",
    "spec": {
      "properties": {
        "*": {
          "id": "=concat(@(1,test.flu),' ',@(1,reportId))"
        }
      }
    }
  }
]

输出:

{
  "properties": [
    {
      "test.flu": "flu1",
      "reportId": 11,
      "id": " 11" // expected output: "flu1 11"
    },
    {
      "test.flu": "flu2",
      "reportId": 12,
      "id": " 12"
    }
  ],
  "type": "node",
  "labels": "label1"
}

因为我的连接字符串有一个句点,所以它没有读取那个字符串。我相信这将是非常小的修复。期待一些帮助。

【问题讨论】:

    标签: json concatenation apache-nifi jolt


    【解决方案1】:

    您必须转义 . 字符才能更改其含义:

    [
      {
        "operation": "modify-default-beta",
        "spec": {
          "properties": {
            "*": {
              "id": "=concat(@(1,test\\.flu),' ',@(1,reportId))"
            }
          }
        }
      }
    ]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多