Reproduced
https://cloud.tencent.com/developer/ask/175357
Problem Description
Some websites data is in a format js file a return does not comply with the format in Python json data. That we can not use json.loads be deserialized.
Regular
demjson
import demjson
# from
js_obj = '{x:1, y:2, z:3}'
# to
py_obj = demjson.decode(js_obj)
jsonnet
import json, _jsonnet
# from
js_obj = '{x:1, y:2, z:3}'
# to
py_obj = json.loads(_jsonnet.evaluate_snippet('snippet', js_obj))
ast
import ast
# from
js_obj = "{'x':1, 'y':2, 'z':3}"
# to
py_obj = ast.literal_eval(js_obj)