When I sort by “name” it sorts properly in descending order. But when I sort by value, it doesn’t sort.
value
is stored as a string in your data. You need to convert it to a number for sorting properly.
sorted(data["foo"][0]["bar"], key=lambda i: int(i["value"]), reverse=True)
CLICK HERE to find out more related problems solutions.