0

This question is similar to With Jolt json transformation, is it possible to copy a value into two different attributes?. But here, I want to use the whole value as one attribute and use part of the value as another attribute.

I have an input like

{
    "data": {
        "data1": "apple",
        "data2": "orange"
    }
}

I want an output like:

{
    "original data": {
        "data1": "apple",
        "data2": "orange"
    }
    "DATA 1": "apple"
}
Azianese
  • 554
  • 7
  • 21

1 Answers1

1

You have to make an array from that one value. Like this:

[
  {
    "operation": "shift",
    "spec": {
      "data": {
        "data1": ["original data.data1",
                  "DATA1"],
        "data2": "original data.data2"
      }
    }
  }
]
Magda
  • 482
  • 4
  • 9