Sagent / playground /phase_json.py
Tim-Saijun's picture
chore(keywords-tool): 整理文件
b820eba
raw
history blame contribute delete
523 Bytes
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2024/5/23 5:43
# @Author : Tim-Saijun https://zair.top
# @File : phase_json.py
# @Project : SAgent
import json
def json_loads(json_str):
try:
return json.loads(json_str)
except Exception as e:
return None
if __name__ == '__main__':
import pathlib
with open(pathlib.Path('data/111.json'), 'r', encoding='utf-8') as f:
json_str = f.read()
res = json_loads(json_str)
print(type(res))
print(res[0].keys())