AutoFramework/Business/Class/JsonOrYaml.py

15 lines
343 B
Python
Raw Normal View History

2022-07-21 08:44:10 +08:00
from Base.Class.Json import *
from Base.Class.Yaml import *
def auto_decode(data):
2022-07-30 01:25:16 +08:00
if data is None:
return data
2022-07-21 08:44:10 +08:00
try:
try:
return json_decode(data)
except:
return yaml_decode(data)
except:
raise Exception('非Json或Yaml数据格式 | String in not a Json or Yaml format.')