簡體   English   中英

JOLT - 置換變換

[英]JOLT - Permutation transformation

我的輸入 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 規范。 我無法在迭代時填充“標題”。

這有效。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM