diagram.json Format
diagram.json describes the circuit of a project: the parts on the canvas and the wires between them. You can read and edit it in the diagram.json tab of the editor; valid changes are applied to the canvas immediately, and invalid ones show an error without changing anything.
Example
{
"version": 1,
"editor": "circzy",
"board": "uno",
"parts": [
{ "id": "uno", "type": "arduino-uno", "x": 0, "y": 0, "rotate": 0, "flip": false, "color": "", "value": "", "level": 0 },
{ "id": "led1", "type": "led", "x": 260, "y": -120, "rotate": 0, "flip": false, "color": "red", "value": "", "level": 0 },
{ "id": "r1", "type": "resistor", "x": 240, "y": -40, "rotate": 90, "flip": false, "color": "", "value": "220", "level": 0 }
],
"wires": [
{ "id": "w1", "from": { "partId": "uno", "pin": "13" }, "to": { "partId": "r1", "pin": "1" }, "color": "#1f9d48", "points": [] },
{ "id": "w2", "from": { "partId": "r1", "pin": "2" }, "to": { "partId": "led1", "pin": "A" }, "color": "#1f9d48", "points": [] },
{ "id": "w3", "from": { "partId": "led1", "pin": "C" }, "to": { "partId": "uno", "pin": "GND.1" }, "color": "#1c1c1c", "points": [{ "x": 300, "y": 40 }] }
]
}
Top-level fields
| Field | Type | Description |
|---|---|---|
version | number | Format version. Currently 1. |
editor | string | Always "circzy". |
board | string | The board ID of the project: uno, nano, mega, esp32, d1mini-esp32, d1r32, nodemcu, nodemcu-amica, d1mini, pico or bluepill. |
parts | array | The parts on the canvas, including the board. |
wires | array | The connections between pins. |
Parts
| Field | Type | Description |
|---|---|---|
id | string | Required. A unique name, used by wires. |
type | string | Required. The part type, for example led, dht22 or arduino-uno. The type of every part is listed in the Parts Reference. |
x, y | number | Position of the top-left corner on the canvas, in pixels. |
rotate | number | 0, 90, 180 or 270 degrees. |
flip | boolean | Mirrors the part, for parts that support it. |
color | string | The color option, for example red for an LED or blue for an LCD. Empty when the part has no color option. |
value | string | The value option: resistor value in ohms ("220"), note text, RFID card UID, DIP switch states ("01000000"), logic analyzer range and so on. |
level | number | The state of an input or the main sensor value: potentiometer position (0–1023), switch position, sensor reading. |
params | object | Extra sensor values, for parts with several sliders, for example { "temperature": 24, "humidity": 40 } for a DHT22. |
The diagram must contain the project's board, and no board of another type. Missing optional fields get their default values.
Wires
| Field | Type | Description |
|---|---|---|
id | string | Required. A unique name. |
from, to | object | The two ends: { "partId": "…", "pin": "…" }. The pin must exist on that part. |
color | string | A CSS color. The editor uses the ten wire colors. |
points | array | Bend points { "x", "y" } in canvas coordinates, in order from from to to. Empty for a direct wire. |
Pin names
Pins are named after the labels printed on the parts: 13, A0, GND.1 on an Arduino Uno; D21, 3V3 on an ESP32 DevKit; VCC, GND, SDA, SCL on an I²C module; A and C for LED anode and cathode; 1 and 2 for resistor legs. When several pins share a name, a suffix such as .1 and .2 makes them unique; pins with the same base name are connected to each other.
Breadboard holes are named <column><half>.<row>, for example 12t.a or 5b.j, and rail holes tp.3, tn.3, bp.3 and bn.3.
Validation errors
| Message | Cause |
|---|---|
| Invalid JSON | The text is not valid JSON. Check commas and quotes. |
| Must contain "parts" and "wires" arrays | One of the arrays is missing. |
parts[n]: "id" is required | A part without an ID. |
parts[n]: unknown part type | The type is not a Circzy part. |
parts[n]: id is used more than once | Two parts share an ID. |
parts[n]: this project uses … | A board of another type was added. |
| The diagram must contain … | The project's board is missing. |
wires[n]: pin not found | A wire refers to a part or pin that does not exist. |
wires[n]: must contain "id", "from", and "to" | A wire is missing one of its required fields. |
wires[n]: id is used more than once | Two wires share an ID. |
wires[n]: bend points must contain x and y | A point in points is incomplete. |
Ready to try it?
Sign in with Google, pick a board and run your first simulation in two minutes. Free during the launch period.
Start simulating free