【问题标题】:Conversion of string to array in jolt transformation颠簸变换中字符串到数组的转换
【发布时间】:2019-11-06 09:24:52
【问题描述】:

我有一个这样的输入 json:

输入:

{
     "userstatus": {
         "authtype": "S,R,T",
     }
}

这里我需要更改密钥 - authtype 并将这些值放入一个数组中。

预期的 Json:

{
    "userstatus": {
        "authtype": ["S","R","T"]
    }
}

但我得到的实际输出是这样的:

{
    "authtype" : [ "S,R,T" ]
}

颠簸规格:

[
    {
        "operation": "shift",
        "spec": {
            "userstatus": {
                "authtype": "authtype.[]"
            }
        }
    }
]

请帮我完成上述测试用例?

【问题讨论】:

    标签: arrays jolt


    【解决方案1】:

    这是您的规格。您应该在修改操作中使用拆分功能。

    [
      {
        "operation": "modify-overwrite-beta",
        "spec": {
          "userstatus": {
            "authtype": "=split(',',@(1,authtype))"
          }
        }
      }
    ]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-02-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-08
      • 2022-01-07
      相关资源
      最近更新 更多