繁体   English   中英

如何获取多个数组值作为对象

[英]How to get multiple array value as object

嗨,我是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"
}
]

规格

[
  {
    "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]
          }
        }
      }
    }
  }
]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM