Merge pull request #259 from fabricehong/fix_fix_json_returning_wrong_type

fixing the "TypeError('the JSON object must be str, bytes or bytearray, not dict')" after a json_fix is successful
This commit is contained in:
Toran Bruce Richards
2023-04-06 10:07:59 +01:00
committed by GitHub

View File

@@ -68,7 +68,8 @@ def fix_json(json_str: str, schema: str, debug=False) -> str:
print(f"Fixed JSON: {result_string}")
print("----------- END OF FIX ATTEMPT ----------------")
try:
return json.loads(result_string)
json.loads(result_string) # just check the validity
return result_string
except:
# Get the call stack:
# import traceback