File size: 523 Bytes
cdf1693
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/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())