python处理json

import json
import jsonpath
#导入json文件
with open('./data/2.json','r',encoding='utf8') as fp:
    json_data=json.load(fp)
#依次获取文件中的列表
entityList=jsonpath.jsonpath(json_data,'$..span')
tagList=jsonpath.jsonpath(json_data,'$..tag')
print(entityList)
print(tagList)

你可能感兴趣的:(json)