Sortieren Sie Json Python
import pprint
# Array of JSON Objects
products = [{"name": "HDD", "brand": "Samsung", "price": "$100"},
{"name": "Monitor", "brand": "Dell", "price": "$120"},
{"name": "Mouse", "brand": "Logitech", "price": "$10"}]
'''
Print the sorted JSON objects in descending order
based on the price key value
'''
print("\nArray of JSON objects after sorting:")
products = sorted(products, key=lambda k: k['price'], reverse=True)
pprint.pprint((products))
Powerful Porpoise