{ "success": true, "code": 0, "message": "操作成功", "datas": { "pageNum": 1, "pageSize": 50, "size": 1, "orderBy": null, "startRow": 1, "endRow": 1, "total": 1, "pages": 1, "list": [ { "productId": "822963734648455728", "productGoodsId": "822963734648455730", "spu": "48760", "sku": "487600101", "skuBarCode": "ÍPlÂ*È14Î", "cnName": "标码(托管)短款露背镂空松紧腰连衣裙", "enName": "Women Dress", "productCategoryId": "550360063609406007", "status": 1, "createdBy": "815273799485362176", "createdTime": "2023-07-24 09:14:12", "type": 2, "isAssemble": 0, "productGoodsSpecifications": [ { "productGoodsSpecificationId": "822963734648455777", "productGoodsId": "822963734648455730", "merchantId": "000035", "name": "Color", "value": "黑色", "sortNo": 1, "type": 1, "typeValueId": 1, "createdTime": "2023-07-24 09:19:22", "createdBy": "815273799485362176", "updatedTime": "2023-07-24 09:19:22", "updatedBy": "815273799485362176", "sku": null }, { "productGoodsSpecificationId": "822963734648455778", "productGoodsId": "822963734648455730", "merchantId": "000035", "name": "Size", "value": "S", "sortNo": 2, "type": 2, "typeValueId": 1, "createdTime": "2023-07-24 09:19:22", "createdBy": "815273799485362176", "updatedTime": "2023-07-24 09:19:22", "updatedBy": "815273799485362176", "sku": null } ], "productGoodsTagList": null, "productDeveloperUserId": "815273799485362176", "shelveStatus": null, "shelvedTime": null, "shelvedRejectReason": null, "skc": "4876001", "suggestPrice": 38.0, "length": 35.0, "width": 27.0, "height": 2.0, "suggestPriceList": null, "productBrandId": "", "description": null, "hsCode": "6104430000", "cnHsName": "女士连衣裙", "enHsName": "Women Dress", "weight": 300.0, "spuStatus": 1, "purchaserName": "林美素", "qualityClassificationId": 173, "path": "/product-service/000035/2023-07-24/317E617C7EAE37C9D1BB2A6AA6BC7E73.JPEG", "md5": "317E617C7EAE37C9D1BB2A6AA6BC7E73", "distributionPriceType": null, "distributionPriceValue": null, "distributionPrice": null, "distributionPriceList": null } ], "prePage": 0, "nextPage": 0, "isFirstPage": true, "isLastPage": true, "hasPreviousPage": false, "hasNextPage": false, "navigatePages": 8, "navigatepageNums": [ 1 ], "navigateFirstPage": 1, "navigateLastPage": 1, "firstPage": 1, "lastPage": 1 }, "others": { "__requestId": "b923a9ed-5c40-477d-969e-63ea86b588cc" } }怎么提取出38.0这个值
时间: 2023-08-05 17:06:16 浏览: 226
你可以使用编程语言或工具来提取 JSON 数据中的特定值。以下是一个使用 Python 的示例代码:
```python
import json
response = '''
{
"success": true,
"code": 0,
"message": "操作成功",
"datas": {
"pageNum": 1,
"pageSize": 50,
"size": 1,
"orderBy": null,
"startRow": 1,
"endRow": 1,
"total": 1,
"pages": 1,
"list": [
{
"productId": "822963734648455728",
"productGoodsId": "822963734648455730",
"spu": "48760",
"sku": "487600101",
"skuBarCode": "ÍPlÂ*È14Î",
"cnName": "标码(托管)短款露背镂空松紧腰连衣裙",
"enName": "Women Dress",
"productCategoryId": "550360063609406007",
"status": 1,
"createdBy": "815273799485362176",
"createdTime": "2023-07-24 09:14:12",
"type": 2,
"isAssemble": 0,
"productGoodsSpecifications": [
{
"productGoodsSpecificationId": "822963734648455777",
"productGoodsId": "822963734648455730",
"merchantId": "000035",
"name": "Color",
"value": "黑色",
"sortNo": 1,
"type": 1,
"typeValueId": 1,
"createdTime": "2023-07-24 09:19:22",
"createdBy": "815273799485362176",
"updatedTime": "2023-07-24 09:19:22",
"updatedBy": "815273799485362176",
"sku": null
},
{
"productGoodsSpecificationId": "822963734648455778",
"productGoodsId": "822963734648455730",
"merchantId": "000035",
"name": "Size",
"value": "S",
"sortNo": 2,
"type": 2,
"typeValueId": 1,
"createdTime": "2023-07-24 09:19:22",
"createdBy": "815273799485362176",
"updatedTime": "2023-07-24 09:19:22",
"updatedBy": "815273799485362176",
"sku": null
}
],
...
"suggestPrice": 38.0,
...
}
],
...
},
"others": {
"__requestId": "b923a9ed-5c40-477d-969e-63ea86b588cc"
}
}
'''
data = json.loads(response)
suggest_price = data['datas']['list'][0]['suggestPrice']
print(suggest_price)
```
运行上述代码,将会输出 `38.0`。首先,我们使用 `json.loads()` 函数将 JSON 字符串转换为 Python 字典。然后,通过字典的键来获取对应的值,即 `data['datas']['list'][0]['suggestPrice']`。你可以根据需要修改代码以适应不同的编程语言或工具。
阅读全文
相关推荐


















