Skip to content

JSON and NDJSON

JSON helpers from annnet.io.json_io.

annnet.io.json_io

Classes

Functions

to_json(graph, path, *, public_only=False, indent=0)

Node-link JSON with x-extensions (slices, edge_slices, hyperedges). Lossless vs your core (IDs, attrs, parallel, hyperedges, slices).

from_json(path)

Load AnnNet from node-link JSON + x-extensions (lossless wrt schema above).

write_ndjson(graph, dir_path)

Write nodes.ndjson, edges.ndjson, hyperedges.ndjson, slices.ndjson, edge_slices.ndjson. Each line is one JSON object. Lossless wrt to_json schema.