Skip to content

JSON and NDJSON

JSON helpers from annnet.io.json_format.

annnet.io.json_format

JSON import/export helpers for AnnNet.

Provides: to_json(G, ...) -> dict from_json(data, ...) -> AnnNet write_ndjson(...) -> None

This module serializes AnnNet graphs to plain JSON-compatible structures and restores them back into AnnNet. Shared dataframe, graph-record, and manifest serialization helpers are routed through the IO common façade.

Classes

Functions

to_json
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
from_json(path)

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

write_ndjson
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.