Parsing Javascript Dictionary

class qqqr.utils.jsjson.AstLoader

AstLoader uses standard ast module to parse the js/json

classmethod json_loads(js, filename='stdin')

The json_loads() function loads a JSON object from a js/json string. It uses standard ast module to parse the js/json.

参数:
  • js (str) – Used to Pass the js/json string to be parsed.

  • filename (str) – Used to Specify the name of the file that is being read. This is only for debug use.

返回类型:

Union[bool, int, str, Dict[Union[str, int], Union[bool, int, str, Dict[Union[str, int], JsonValue], List[JsonValue]]], List[Union[bool, int, str, Dict[Union[str, int], JsonValue], List[JsonValue]]]]

返回:

A JsonValue object.

qqqr.utils.jsjson.json_loads(js)

The json_loads() function converts a string representation of JS/JSON data into a Python object. Current implementation is using ast.

If you need more parameters or another implementation, call xxxLoader.json_loads instead.

参数:

js (str) – Used to Pass the JS/JSON string.

返回类型:

Union[bool, int, str, Dict[Union[str, int], Union[bool, int, str, Dict[Union[str, int], JsonValue], List[JsonValue]]], List[Union[bool, int, str, Dict[Union[str, int], JsonValue], List[JsonValue]]]]

返回:

A JsonValue object.