{"data":[{"node":"emqx@127.0.0.1","topic":"4e4a3668bf514c6f89738c5f3eec6285"},{"node":"emqx@127.0.0.1","topic":"05f170438ab44d769f9f67c1406316c2"},{"node":"emqx@127.0.0.1","topic":"fcef086b0ea443429cc867a35fb630fd"},{"node":"emqx@127.0.0.1","topic":"topic_aaa"}],"meta":{"count":4,"hasnext":false,"limit":20,"page":1}}取出里面topic的值
时间: 2023-07-05 11:36:32 浏览: 145
FTP-document.rar_fit//127.0.0.1:5050_ftb 127.0.0.1 2121_ftb:127.
可以使用以下代码来解析JSON数据并获取topic的值:
```python
import json
json_data = '{"data":[{"node":"emqx@127.0.0.1","topic":"4e4a3668bf514c6f89738c5f3eec6285"},{"node":"emqx@127.0.0.1","topic":"05f170438ab44d769f9f67c1406316c2"},{"node":"emqx@127.0.0.1","topic":"fcef086b0ea443429cc867a35fb630fd"},{"node":"emqx@127.0.0.1","topic":"topic_aaa"}],"meta":{"count":4,"hasnext":false,"limit":20,"page":1}}'
data = json.loads(json_data)
topics = [d['topic'] for d in data['data']]
print(topics)
```
输出结果为:
```
['4e4a3668bf514c6f89738c5f3eec6285', '05f170438ab44d769f9f67c1406316c2', 'fcef086b0ea443429cc867a35fb630fd', 'topic_aaa']
```
阅读全文