'Java Jolt: can't find proper spec for my transformation

I'm struggling with that Jolt transformation: Here is my input JSON

{
  "bloc1-1": {
    "bloc1-2": [
      {
        "key": "key1",
        "value": "value1-1"
      },
      {
        "key": "key2",
        "value": "value1-2"
      }
    ]
  },
  "bloc2-1": {
    "bloc2-2": [
      {
        "key": "key1",
        "value": "value2-1"
      },
      {
        "key": "key2",
        "value": "value2-2"
      },
      {
        "key": "key3",
        "value": "value2-3"
      }
    ]
  }
}

Here is what I'm expecting

{
  "bloc1-key1" : "value1-1",
  "bloc1-key2" : "value1-2",
  "bloc2-key1" : "value2-1",
  "bloc2-key2" : "value2-2",
  "bloc2-key3" : "value2-3"
}

I have tried the following spec, but I cannot figure out how to prefix the key in the RHS (the @ should be the first character)

[
  {
    "operation": "shift",
    "spec": {
      "*": {
        "*": {
          "*": {
            "value": "@(1,key)"
          }
        }
      }
    }
  }
]

and got that

{
  "key1" : [ "value1-1", "value2-1" ],
  "key2" : [ "value1-2", "value2-2" ],
  "key3" : "value2-3"
}

Any help would be appreciated



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source