0

Hi I am new to JOLT transformation. I need to transform the input json using JOLT to get below seen output. Please help me in below transformation:

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

output:

[
{
   "image": "content1",
   "legal": "legal1",
   "hyper": "hyper1"
},
{
   "image": "content1",
   "legal": "legal1",
   "hyper": "hyper1"
},
{
   "image": "content1",
   "legal": "legal1",
   "hyper": "hyper1"
}
]
Manan Kapoor
  • 675
  • 1
  • 11
  • 28
  • I'm sure you can find samples out there which can get you started, and if it doesn't work then you should come back and ask a specific question. Write code for someone else isn't what this forum is about. – Mattias Lindberg Sep 22 '15 at 07:06

1 Answers1

1

Spec

[
  {
    "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]
          }
        }
      }
    }
  }
]
Milo S
  • 4,466
  • 1
  • 19
  • 22