skip to Main Content

I want to write a jolt transformation to get the below output

Input

{
  "payload": {
    "header": {
      "abc": "demo",
      "def": "demo1"
    },
    "payload": {
      "qwer": "asdf",
      "zxcv": "uiop"
    }
  }
}

Output

{
  "header": {
    "abc": "demo",
    "def": "demo1"
  },
  "payload": {
    "qwer": "asdf",
    "zxcv": "uiop"
  }
}

can this be achieved in jolt

2

Answers


  1. Yes, we can achieve the expected output using jolt.

    Here is the Jolt spec to get the expected output.

    [
      {
        "operation": "shift",
        "spec": {
          "payload": {
            "*": "&"
          }
        }
      }
    ]
    
    Login or Signup to reply.
  2. Here’s the Jolt transformation spec to achieve the desired output:

    JSON

    [
      {
        "operation": "shift",
        "spec": {
          "payload": {
            "header": "@(1,header)",
            "payload": "@(1,payload)"
          }
        }
      }
    ]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search