Skip to main content

from_json()

The graph of the type named in the JSON, validated in strict mode.

Usage

Source

from_json(string)
>>> from_json('{"type":"MolGraph","symbols":["H","H"],"bonds":[[0,1]],'
...           '"charge":0,"spin":0}').bonds

((0, 1),)

Raises

GraphError
If the string is not a JSON object, names no known type, has a field that doesn’t belong to its type, has a value of the wrong JSON type (such as "1" or 1.0 for an int), or gives an invalid graph.