每个字段的Jolt Transformation返回数组

时间:2019-01-11 22:58:08

标签: jolt

我不高兴。我需要将输入转换为文档数组,但每个字段都有一个数组。除此之外,我尝试删除所有空或空字段。我得到了,但不是以公正的方式。你可以帮帮我吗?

这是我的输入内容

 [
  [
    {
      "NAME": "Fred",
      "SURNAME": null,
      "NUMBER": "0010342863177",
      "ADDRESS": "add"
    },
    {
      "NAME": "Mark",
      "SURNAME": null,
      "NUMBER": "0010342863177",
      "ADDRESS": "add"
    },
    {
      "NAME": "Mil",
      "SURNAME": null,
      "NUMBER": "0010342863177",
      "ADDRESS": ""
    }
  ]
]

我根据之前的问题和指南提供了此规范:

[
  {
    "operation": "default",
    "spec": {
      "*": {
        "*": {
          "*": ""
        }
      }
    }
  },
  {
    "operation": "shift",
    "spec": {
      "*": {
        "*": {
          "*": {
            "": null,
            "*": {
              "@1": "&2"
            }
          }
        }
      }
    }
  }
]

我期望下面的输出:

[
    {
      "NAME": "Fred",
      "NUMBER": "0010342863177",
      "ADDRESS": "add"
    },
    {
      "NAME": "Mark",
      "NUMBER": "0010342863177",
      "ADDRESS": "add"
    },
    {
      "NAME": "Mil",
      "NUMBER": "0010342863177",
      "ADDRESS": ""
    }
]

但实际输出是:

{
  "NAME" : [ "Fred", "Mark", "Mil" ],
  "NUMBER" : [ "0010342863177", "0010342863177", "0010342863177" ],
  "ADDRESS" : [ "add", "add" ]
}

0 个答案:

没有答案