-1

我的输入 JSON

{
    "title": [
        "vsnu",
        "anothervsnu"
    ]
}

我的规格

[
  {
    "operation": "shift",
    "spec": {
      "title": {
        "*": {
          "$(1)": "Responses[].head",
          "@": "Responses[].name"
        }
      }
    }
  }
]

我的输出:

{
  "Responses" : [ {
    "head" : "title"
  }, {
    "name" : "vsnu"
  }, {
    "head" : "title"
  }, {
    "name" : "anothervsnu"
  } ]
}

预期输出:

{
  "Responses" : [ {
    "head" : "title",
    "name" : "vsnu"
  }, {
    "head" : "title",
    "name" : "anothervsnu"
  } ]
}

请帮助我为上述预期输出编写正确的 JOLT 规范。迭代时我无法填充“标题”。

4

1 回答 1

1

这行得通。

[
  {
    "operation": "shift",
    "spec": {
      "title": {
        "*": {
          "$(1)": "Responses.[#2].head",
          "@": "Responses.[#2].name"
        }
      }
    }
  }
]
于 2016-03-23T10:05:52.073 回答