我目前是 python 的新手,我目前的目标是从我已从 RESTful API 转换为字典格式的 JSON 数据中检索特定的键和值,并将它们分配给新字典,以便我可以在 HTML 模板中显示它们在表格形式的烧瓶中。
下面是提到的 JSON 数据,我只想提取“用户”中的“dateRented”、“用户名”、“车辆”中的“vehicleModel”和“vehicleBrand”。
[
{
"dateRented": "2020-05-22",
"recordsID": 1,
"user": {
"firstname": "Ching",
"imageName": "croppedCY",
"password": "gAAAAABeuQsw-u6FTh3_2VZiXZGTuiJEhbBuLB4FwyPj5xKb33tkJ7HTH7YvZTWxi0MJ3UKqLQAd6LHoXgCahB1gC5qJo9wSHw==",
"surname": "Loo",
"userID": 10,
"username": "CY"
},
"vehicle": {
"colour": "White",
"cost": 15,
"latitude": null,
"longitude": null,
"rentalStatus": "True",
"seats": 4,
"user": null,
"vehicleBrand": "Honda",
"vehicleID": 4,
"vehicleModel": "CRZ"
}
}
]
慕丝7291255
GCT1015
相关分类