Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache nifi Nifi JoltTransformJSON:在键名中保留下划线符号_Apache Nifi_Jolt - Fatal编程技术网

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

Apache nifi Nifi JoltTransformJSON:在键名中保留下划线符号,apache-nifi,jolt,Apache Nifi,Jolt,我试图用ApacheNIFI编写一个转换json格式的jolt。我成功地转换了震动,但有一个属性缺少下划线: 输出: { "Source": { //source is missing underscore. It should look like _Source "userName": "Lulu" } } 我的意见如下: { "user_name": "Lulu" } [

我试图用ApacheNIFI编写一个转换json格式的jolt。我成功地转换了震动,但有一个属性缺少下划线:

输出:

          {
     "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": "" } 
               }
]
当前,我的震动表达式如下所示:

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

                    "userName": "" } 
               }
]
如何保持下划线登录属性“Source”


我一直在琢磨这部分。我想知道我在摇晃的表情中遗漏了什么。提前谢谢,伙计们,我想下划线可能是该运算符中的某种特殊字符,请尝试在源代码前面使用双反斜杠:

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

我认为下划线可能是该运算符中的某种特殊字符,请尝试在_Source前面使用双反斜杠:

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

只需一次“移位”就可以做到这一点

规格


只需一次“移位”就可以做到这一点

规格