JGF 2.0
JGF 2.0 (JSON Graph Format, version 2) is a lightweight, open specification for encoding graph structure in plain JSON. It is maintained by the "jsongraph" organization on GitHub, published under json-graph-specification with a companion site at jsongraphformat.info, and validated against JSON Schema. The format registers the media type application/vnd.jgf+json. Its stated goal is to capture basic graph structure in a convenient, human-readable form while leaving room for arbitrary application data through metadata.
A JGF document is a single top-level JSON object that contains either one graph object or a graphs array of them, so several graphs can travel in one file. A graph object carries a directed flag (defaulting to true), optional type, label, and metadata, plus a nodes container and an edges array. The defining change from version 1 to version 2 is that nodes are no longer an array but a map (JSON object) keyed by node id; each node value holds an optional label and a free-form metadata object. Using the id as the object key guarantees node-id uniqueness structurally. Each edge is an object with source and target (referencing node keys) plus optional relation, directed, label, id, and metadata. A later revision (early 2021) added hyperedges for undirected node sets and directed many-to-many relations. The metadata escape hatch is where layout, styling, weights, and algorithm results are conventionally stored.
Within the format-conversion landscape, JGF occupies the same niche as other JSON graph encodings such as format:jgf, format:jgf-1.0, format:graphjson, format:gjgf-0.1, format:networkx-node-link, and format:cytoscape-json: a generic, tool-agnostic interchange for node/edge data, contrasting with heavier XML formats like format:graphml or format:gexf-1.3. Its schema-driven design has spawned domain child schemas, notably the BEL JSON Graph Format for biological expression data.
Strengths: minimal, readable, JSON-native, schema-validated, multi-graph and metadata friendly, easy to parse in any language. Tooling includes the Node.js library tool:jay-gee-eff and the json-graph-specification npm package; the format is also consumed by visualization libraries such as tool:gravis. Limitations: it standardizes structure but not semantics, so metadata conventions vary between producers; the keyed-node map complicates ordering and streaming of very large graphs; and adoption remains narrower than GraphML or GEXF, with tooling comparatively sparse.
Alternative Names: JSON Graph Format
| Feature | JSON Graph Format 2.0 |
|---|---|
| Multiple Graphs per Document | |
| Nodes | |
| Undirected Edges | |
| Directed Edges | |
| Hyperedges | |
| Mixed-directionality Edges | |
| Parallel Edges | |
| Self-loops | |
| Edges on Edges | |
| Nested Graphs in Nodes | |
| Nested Graphs in Edges | |
| Nested Graphs in Graphs | |
| Node Labels | |
| Edge Labels | |
| Attributes on Nodes | |
| Attributes on Edges | |
| Attributes on Graphs | |
| Typed Edges | |
See also
Frequently Asked Questions
What is a JSON Graph Format 2.0 file?
A JSON Graph Format 2.0 file stores a graph — its nodes, edges and attributes — in the JSON Graph Format 2.0 format (also: JSON Graph Format). See the feature table above for what it supports.
How do I open a JSON Graph Format 2.0 file?
Open it in a graph tool that supports JSON Graph Format 2.0, or convert it to a format your tool reads. With GraphInOut you can convert JSON Graph Format 2.0 to GraphML, DOT, Connected JSON and more, right in your browser.
How do I convert a JSON Graph Format 2.0 file to another format?
Use the Convert from JSON Graph Format 2.0 link above: upload or paste your JSON Graph Format 2.0 file (input preset to JSON Graph Format 2.0), choose a target format and download the result — free, no install.