1

How to achieve following using JMESPath?

Input:

[
   {"letter": "A", "word": "Apple"},
   {"letter": "B", "word": "Ball"},
   {"letter": "C", "word": "Cat"}
]

Expected Output:

[
   {"A": "Apple"},
   {"B": "Ball"},
   {"C": "Cat"}
]

I have tried the following, but, it does not work for key while it works for value:

[].{@.letter: @.word}

Fairly a simple requirement, should be a small thing I am missing here.

β.εηοιτ.βε
  • 33,893
  • 13
  • 69
  • 83
Sachin Dangol
  • 504
  • 5
  • 13
  • 1
    This is not possible in JMESPath, as explained in [Dynamic/computed keys in JMESPath?](https://stackoverflow.com/questions/45236960/dynamic-computed-keys-in-jmespath) – β.εηοιτ.βε Mar 08 '22 at 19:57

0 Answers0