Nifi JoltTransformJSON:在键名中保留下划线符号

Nifi JoltTransformJSON : Keeping the underscore sign in key name

我正在尝试在 Apache Nifi 中编写一个 jolt 来转换 json 形式。我设法转换了震动,但缺少一个属性下划线:

输出:

          {
     "Source": {   //source is missing underscore. It should look like _Source
           "userName": "Lulu"
      }
  }

我的输入如下:

     {
        "user_name": "Lulu"
     }

目前我的震惊表情如下:

[
        {
          "operation": "shift",
          "spec": {
               "user_name":"userName"
           }
        },
        {
          "operation": "modify-overwrite-beta",
          "spec": {         
              "_Source":{
                  "userName":"@(2,userName)"
               }
           }
         },
         { "operation": "remove", 
          "spec": { 

                    "userName": "" } 
               }
]

如何在属性 "Source" 中保留下划线符号?

我一直在搞清楚这部分。我想知道我在震惊的表情中遗漏了什么。提前致谢,伙计们

我认为下划线可能是该运算符中的某种特殊字符,请在 _Source:

前面尝试 double-backslashes
[
  {
    "operation": "shift",
    "spec": {
      "user_name": "userName"
    }
        },
  {
    "operation": "modify-overwrite-beta",
    "spec": {
      "\_Source": {
        "userName": "@(2,userName)"
      }
    }
         },
  {
    "operation": "remove",
    "spec": {
      "userName": ""
    }
  }
]

一个人就能搞定"shift"。

规格

[
  {
    "operation": "shift",
    "spec": {
      "user_name": "_Source.userName"
    }
  }
]