如何选择JSON中的最小属性?



我正在开发一个用于获取Solanart底价的不和谐机器人。我使用这个JSON: https://qzlsklfacc.medianetwork.cloud/nft_for_sale?collection=cryptocavemen

如何在这个JSON文件中选择最低价格?

程序需要在用户每次进入不一致楼层时找到最低价格

这是我的代码。这一切都工作得很好,但我不知道如何获得最小的价格属性。
import discord
import os
import json
import urllib
my_secret = os.environ['TOKEN']
client = discord.Client()
with urllib.request.urlopen("https://qzlsklfacc.medianetwork.cloud/nft_for_sale? 
collection=cryptocavemen") as url:
data = json.loads(url.read().decode())

@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('!floor'):
??????????
await message.channel.send("The Floor Price is: " + #floor price data )
client.run(my_secret)

需要你的帮助!谢谢!

不要认为它是一个JSON文件,一旦它准备好作为json.loads,它只是一个字典列表,您可以检查每个字典的price属性。

如果您只想返回最低的价格,您可以将mapmin函数组合在一起,在一行中获得结果:

floor_price = min(map(lambda x: x['price'], data))