0

I'm struggling with a very simple jolt transformation. I want to copy the whole input json (structure not known) into an array in the output json.

So for example the input could be:

{
    "rating": {
        "quality": {
            "value": 3,
            "max": 5
        }
    }
}

The output should look like this:

{
    "items": [{
        "item": {
            "rating": {
                "quality": {
                    "value": 3,
                    "max": 5
                }
            }
        }
    }]
}

Basically put the whole input json into an object called item into an array called items.

Could you please help me? thx

mweb84
  • 47
  • 3
  • 7

2 Answers2

1

I found the solution by myself. The required spec is

[
  {
    "operation": "shift",
    "spec": {
      "@1": {
        "@": "items[].item"
      }
    }
  }
]
mweb84
  • 47
  • 3
  • 7
0
[
  {
    "operation": "shift",
    "spec": {
      "@": "items[0].item"
    }
  }
]
Milo S
  • 4,466
  • 1
  • 19
  • 22