json.loads()
json.loads() is a Python function in the JSON Module category. Deserializes a JSON string to a Python object. The syntax is json.loads(s, *, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None). Parameters: s — JSON string. Returns: Python object. A typical example: json.loads('{"a": 1}') # {"a": 1}
json.loads('[1, 2, 3]') # [1, 2, 3]. A close sibling is json.dumps(), which serializes a Python object to a JSON formatted string. A close sibling is json.dump(), which serializes a Python object to a JSON formatted stream (file). A close sibling is json.load(), which deserializes a JSON formatted stream (file) to a Python object. A close sibling is json.JSONEncoder(), which extensible JSON encoder for custom serialization. More about this category: JSON encoding and decoding — dump, load, dumps, loads. For a broader walkthrough, read the JSON Module guide. Related JSON Module entries: json.dumps(), json.dump(), json.load(), json.JSONEncoder(), json.JSONDecoder().