> ## Documentation Index
> Fetch the complete documentation index at: https://iso-topology.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Choose D2, YAML, or JSON

> Choose a source format for graph authoring, visual editing, programmatic generation, and the agent repair loop.

Start with **D2** for a small relationship graph. Choose **YAML** when an agent will repair the scene or a person will adjust it in Studio. Use **JSON** when another program produces the composition.

| Task | D2 | YAML | JSON |
| - | - | - | - |
| Describe nodes and relationships | Compact graph syntax | Explicit scene model | Same scene model as YAML |
| Automatic layout | Dagre or ELK | Container modes and relative placement | Same composition layout |
| Themes, groups, geometry | Supported translated subset | Full composition vocabulary | Full composition vocabulary |
| Render SVG / top-down view | Yes | Yes | Yes |
| Source repair | No | Yes | No |
| Studio visual-edit workflow | Prefer source editing | Recommended | Prefer source editing |

Visual edit operations use YAML-aware text transformations. Do not assume that rendering support means every canvas edit works in every source dialect. D2 and JSON remain useful for source editing and preview.

## A relationship graph

```d2 theme={null}
user: User { shape: person }
api: API Gateway
db: Database { shape: cylinder }
user -> api: HTTPS
api -> db: query
```

Save it as `services.d2`, then `isotopo render services.d2 ./out`.

## An editable composition

Download the [complete YAML starter](../assets/first-diagram.yaml), save it as `input.yaml`, and run `isotopo serve input.yaml`. It expresses the same three roles with a row layout and explicit styles.

YAML and JSON share the `canvas`, `theme`, and `nodes` model. They support `layout`, `place`, and explicit offsets. JSON is useful at a program boundary; YAML is convenient for human and agent revisions.

## Moving between formats

There is no general lossless D2-to-YAML command documented here. Re-author the scene using the composition model, preserving node identities and connections, then inspect the output. A matching graph does not imply identical geometry or styling.

[CLI quickstart](https://iso-topology.mintlify.site/quickstart.md) · [YAML reference](https://iso-topology.mintlify.site/reference/dsl-yaml.md) · [D2 mapping](https://iso-topology.mintlify.site/reference/dsl-d2.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.