ardlema
ardlema

Reputation: 85

Jolt transformation to keep just the array of elements

I need to create a pretty simple jolt transformation to convert the following json:

{
  "pfr_item": [
    {
      "field1": "value1"
    },
    {
      "field2": "value2"
    }
  ]
}

Into the following one:

[{
        "field1": "value1"
    },
    {
        "field2": "value2"
    }
]

I've been having a look at some jolt examples and trying to create my own shift transformation for a while but can't make it work. Can anyone help me with this?

Upvotes: 0

Views: 338

Answers (1)

Jagadesh
Jagadesh

Reputation: 2116

You can try this JSON Spec

[
  {
    "operation": "shift",
    "spec": {
      "*": {
        "*": "[]"
      }
    }
  }
]

Upvotes: 2

Related Questions