json解析脚本
# json解析
def json1():
with open("./apk_list",'r') as fp:
lines = fp.readlines()
lines = [line.strip() for line in lines]
#print(lines)
# 根据编号查询json
json2="""
{
"4": {
"id": 4,
"title": "地铁跑酷",
"url": "https://www.taptap.com/app/4",
"file_path": "/f/202110/18/a/804698c5a9f73de6f9b75fd7797ed55a",
"version_code": 32500,
"version_name": "3.25.0",
"developer_type": "企业开发者",
"developer_name": "深圳市创梦天地科技有限公司"
},
"2422862": {
"id": 2422862,
"title": "压力山大",
"url": "https://www.taptap.com/app/226725",
"file_path": "/f/202111/16/a/7f8de9e38cbd5e7be1978749cb2cddd4",
"version_code": 1,
"version_name": "1.0",
"developer_type": "企业开发者",
"developer_name": "深圳乐乐无限科技有限公司"
}
}
"""
test_str = "".join(lines)
#print(type(test_str))
#print(type(json2))
text = demjson.decode(test_str)
#print(text)
#print(text["2422862"])
#print(text["2422862"]["title"])
#fp = file('test_json.txt', 'w')
#json.dump(d, fp)