Randy
Randy

Reputation: 81

Jolt convert array keys

I want to convert keys in array json by using jolt Input

[
  {
    "TestString": "AGC",
    "TestNumber": "3"
  },
  {
    "TestString": "DDD",
    "TestNumber": "2"
  }
]

Out put:

[
  {
    "test_string": "AGC",
    "test_number": "3"
  },
  {
    "test_string": "DDD",
    "test_number": "2"
  }
]

What is jolt spec will be?

Upvotes: 0

Views: 326

Answers (1)

user3409708
user3409708

Reputation: 46

  [{
    "operation": "shift",
    "spec": {
      "*": {
        "TestString": "[&1].test_string",
        "TestNumber": "[&1].test_number"
      }
    }
  }]

Upvotes: 1

Related Questions