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"
}
]
1
  • 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. Commented Sep 22, 2015 at 7:06

1 Answer 1

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]
          }
        }
      }
    }
  }
]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.