将布尔值转换为字符串以获取 nifi jolt 中的地图值

convert Boolean to String for map values in nifi jolt

我想在 NIFI 中使用 Jolt 处理器实现以下 JSON 转换 json中的输入是一个映射(这里图像是一个键,image1.png是一个值,等等,具有不同的类型(String,Boolean)

输入JSON

{
  "internal_value": "434252345",
  "settings": {
    "image": "image1.png",
    "bold": false,
    "country": false
  }
}

输出JSON应该是

{
  "internal_value": "434252345",
  "settings": {
    "image": "image1.png",
    "bold": "false",
    "country": "false"
  }
}

有没有办法使用现有的 Jolt 操作来做到这一点?

谢谢。

作为纯粹的 JOLT,这将是:

[
  {
    "operation": "modify-overwrite-beta",
    "spec": {
      "settings": {
        "bold": "=toString",
        "country": "=toString"
      }
    }
  }
]

您可以使用此工具制作 JOLT 原型: https://jolt-demo.appspot.com/#inception

资源:

JOLT change string to float