简体   繁体   English

修改值后键值对的颠簸转换规范

[英]Jolt transformation spec for the key Value pair after modifying values

This is the input这是输入

"header": {
        "FOO": "VALUE1",
        "BAR": "VALUE2",
      }

Expected Output预计 Output

 {
      "Random_VALUE1": "Random_VALUE1"
     } 

SO the output needs a key which is a combination of one of the key's value and some String, and the output should contain this output as key and value所以 output 需要一个键,它是键的值和一些字符串之一的组合,并且 output 应该包含这个 output 作为键和值

This is how far I have reached这就是我达到的程度

{
     "operation": "modify-default-beta",
     "spec": {
       "*": {
         "e": "=concat('RANDOM_',@(1,FOO))",
         "r": "=concat('RANDOM_',@(1,FOO))"
       }
     }
   },
   {
     "operation": "modify-overwrite-beta",
     "spec": {
       "*": {
         "&e": "[&2].@e",
         "&r": "[&2].@r"
       }
     }
    }

The spec is throwing error OVERWRITR cannot have AmpPathElement RHS I am not sure what is wrong with the approach I am using and what should be the spec for the output规范抛出错误OVERWRITR cannot have AmpPathElement RHS我不确定我使用的方法有什么问题以及 output 的规范应该是什么

Not sure if this is what you meant, but there goes a try;)不确定这是否是您的意思,但可以尝试一下;)

Input :输入

{
  "header": {
    "FOO": "VALUE1",
    "BAR": "VALUE2"
  }
}

Spec :规格

[
  {
    "operation": "modify-default-beta",
    "spec": {
      "*": {
        "e": "=concat('RANDOM_',@(1,FOO))",
        "r": "=concat('RANDOM_',@(1,BAR))"
      }
    }
   },
  {
    "operation": "shift",
    "spec": {
      "*": {
        "e": ".@(1,e)",
        "r": ".@(1,r)"
      }
    }
   }
]

Output : Output

{
  "RANDOM_VALUE1" : "RANDOM_VALUE1",
  "RANDOM_VALUE2" : "RANDOM_VALUE2"
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM