MCPcopy Create free account
hub / github.com/DVampire/FinAgent / save_json

Function save_json

finagent/utils/json_utils.py:12–23  ·  view source on GitHub ↗
(json_dict, file_path, indent=4)

Source from the content-addressed store, hash-verified

10 return json_dict
11
12def save_json(json_dict, file_path, indent=4):
13 with open(file_path, mode='w', encoding='utf8') as fp:
14 try:
15 if indent == -1:
16 json.dump(json_dict, fp, ensure_ascii=False)
17 else:
18 json.dump(json_dict, fp, ensure_ascii=False, indent=indent)
19 except Exception as e:
20 if indent == -1:
21 json5.dump(json_dict, fp, ensure_ascii=False)
22 else:
23 json5.dump(json_dict, fp, ensure_ascii=False, indent=indent)
24
25def check_json(json_string):
26 try:

Callers 15

mainFunction · 0.90
runFunction · 0.90
mainFunction · 0.90
runFunction · 0.90
mainFunction · 0.90
runFunction · 0.90
mainFunction · 0.90
runFunction · 0.90
mainFunction · 0.90
runFunction · 0.90
mainFunction · 0.90
runFunction · 0.90

Calls

no outgoing calls

Tested by 1

runMethod · 0.72