I’m new to python/jmespath and am trying to sort the below students by their final grade in 2024. I’m sure I can come up with something in python to do it but was just wondering if there is any jmespath magic I can use. I have seen sort_by and know how to search/sort by simple attributes, but haven’t yet found anything that can do this.
{
school: 'lame',
students: [
{
id: 1,
name: 'Joe',
grades: [
{year: 2024, final: 85},
{year: 2023, final: 73}
]
},
{
id: 2,
name: 'Pedro',
grades: [
{year: 2024, final: 92},
{year: 2023, final: 90}
]
},
{
id: 3,
name: 'Mary',
grades: [
{year: 2024, final: 88},
{year: 2023, final: 70}
]
}
]
}