0

嗨,我是 JOLT 转型的新手。我需要使用 JOLT 转换输入 json 以获得低于可见的输出。请帮助我进行以下转换:

input:
  {
    "image": [
      "content1",
      "content2",
      "content3"
],
   "legal": [
      "legal1",
      "legal2",
      "legal3"
 ], 
"hyper": [
      "hyper1",
      "hyper2",
      "hyper3"
]
}

输出:

[
{
   "image": "content1",
   "legal": "legal1",
   "hyper": "hyper1"
},
{
   "image": "content1",
   "legal": "legal1",
   "hyper": "hyper1"
},
{
   "image": "content1",
   "legal": "legal1",
   "hyper": "hyper1"
}
]
4

1 回答 1

1

规格

[
  {
    "operation": "shift",
    "spec": {
      "*": { // image, legal, etc
        "*": { // array
          "*": { // content1, legal1, etc
            "$": "[&2].&3" // grab "content1" and use it as output
                 // send it to an output doc that is a top level array
                 // indexed by looking 3 levels up the tree [&2]
          }
        }
      }
    }
  }
]
于 2016-07-01T22:31:01.567 回答