Netlists
- Structure: A netlist is one JSON object with
componentsandnetsarrays. Components describe the parts; nets describe which terminals are connected. - Component: Give each part a unique
id, a supportedtype, and a displayvalue. Built-in types have predefined pins; unknown types need an explicitpinslist. - Connections: Write each terminal as
componentID.pinName, such asR1.a. A net'snamelabels the connection; itspinsarray lists the terminals that share it. - Rules: IDs and net names start with a letter and then use letters, digits, or underscores. Each reference must point to an existing component and valid pin, and a pin can belong to only one net.
- Check or draw: Run
circuit validate FILE.jsonto check netlist structure and available electrical rules, orcircuit render FILE.json -o FILE.svgto create a schematic.
Netlist structure
A netlist is a JSON object with two arrays: components and nets. Start with this shape, then add parts and connections to the arrays:
{
"components": [],
"nets": []
}
Each item in components describes one part. Each item in nets describes one electrical connection shared by one or more component terminals.
Built-in components
Use a built-in type when CircuitGen already has a symbol for the part. Its pin names are predefined, so you do not need to add a pins field. The Components reference lists built-in types and their exact pins.
Component fields
| Field | What it means | Rules |
|---|---|---|
id | Unique name for this instance, such as R1 or U1. | Must begin with an ASCII letter; after that, use letters, digits, or _. Maximum 32 characters. |
type | Symbol or component definition to use, such as resistor, battery, or ne555. | Must begin with a letter and use letters, digits, or _. Built-in types use their registered pin names. |
value | Text shown as the component's value or label. | Required string. Recognized electrical values are formatted for display; descriptive labels are kept. |
pins | Logical pin names for a custom or unknown type. | Optional for built-ins; required for unknown types. Pin names are case-sensitive. |
For example, these components use built-in symbols and pins:
{"id": "R1", "type": "resistor", "value": "10 kΩ"}
{"id": "B1", "type": "battery", "value": "9 V"}
{"id": "D1", "type": "led", "value": "red"}
The resistor and LED have pins a and b; the battery has pins p and n. Use the exact pin spelling shown in the Components reference. Pin names are case-sensitive.
Custom components
Use a custom component when the part has no built-in symbol. Supply its logical pin names in pins; CircuitGen draws it as a rectangular symbol. The names are yours to choose, but each must be 1–24 characters using letters, digits, _, +, or -, and no two pins on the same component may have the same name.
{"id": "S1", "type": "soil_sensor_module", "value": "Sensor", "pins": ["VCC", "GND", "OUT"]}
Because this type is not built in, pins defines the terminals available to references such as S1.OUT. These are labels for the schematic, not a verified physical pinout. Do not add a custom pins list to redefine the pins of a built-in type; its list must match the registered pins.
Terminal references and nets
A terminal reference identifies one pin on one component. It has exactly one dot:
componentID.pinName
For example, R1.a means pin a on component R1. R1 is the component ID; a is the pin name. Neither is a net name.
Every net has a name and a pins array. The net name labels the connection, while the array contains terminal references. All pins in one array are electrically connected. A net name starts with a letter and can then contain letters, digits, or underscores; names are unique within a netlist.
Connect two terminals
This joins battery positive to one side of a resistor:
{"name": "SUPPLY", "pins": ["B1.p", "R1.a"]}
SUPPLY is only the connection's label. The references B1.p and R1.a identify the actual terminals.
Join several terminals
Add more references to the same array when they share one connection:
{"name": "SUPPLY", "pins": ["B1.p", "R1.a", "S1.VCC"]}
This connects all three listed terminals to the same net. Every reference must name a component in components and one of that component's valid pins. A pin can appear in only one net.
Connect nets through a component
A component joins its own terminals as part of the circuit, but its different terminals remain distinct pins. For example, if R1.a is on SUPPLY and R1.b is on LED_IN, the resistor connects those two nets through its body. SUPPLY and LED_IN remain separate net names.
{"name": "SUPPLY", "pins": ["B1.p", "R1.a"]}
{"name": "LED_IN", "pins": ["R1.b", "D1.a"]}
Ground and power connections
Names such as GND, VCC, or 5V do not create a voltage source, power symbol, or ground symbol. They only label nets. Connect actual source terminals, such as B1.p and B1.n, to the appropriate nets. To draw a ground symbol, include a ground component and connect its gnd terminal. CircuitGen does not add power or ground symbols just because of a net's name.
Complete LED example
Save this as led.json, or download it:
{
"components": [
{"id": "V1", "type": "battery", "value": "9 V"},
{"id": "R1", "type": "resistor", "value": "360 Ω"},
{"id": "D1", "type": "led", "value": "red"}
],
"nets": [
{"name": "SUPPLY", "pins": ["V1.p", "R1.a"]},
{"name": "LED_ANODE", "pins": ["R1.b", "D1.a"]},
{"name": "RETURN", "pins": ["D1.b", "V1.n"]}
]
}
SUPPLY connects the battery's positive terminal to the resistor. LED_ANODE connects the resistor to the LED's anode (a). RETURN connects the LED's other terminal (b) to the battery's negative terminal. Together, the three nets and the components form one loop.
Common mistakes
Referencing a component that does not exist
Invalid: R2 is not in the components array.
{"name": "SUPPLY", "pins": ["V1.p", "R2.a"]}
Correct it by referencing an existing component, or add R2 to components:
{"name": "SUPPLY", "pins": ["V1.p", "R1.a"]}
Using the wrong pin name
Invalid: a battery uses p and n, not + and -.
{"name": "SUPPLY", "pins": ["V1.+", "R1.a"]}
Correct: use the built-in battery pin name p:
{"name": "SUPPLY", "pins": ["V1.p", "R1.a"]}
Reusing a component ID
Invalid: each component must have a unique ID.
{"components": [{"id": "R1", "type": "resistor", "value": "1 kΩ"}, {"id": "R1", "type": "resistor", "value": "2 kΩ"}]}
Correct: assign the second part a different ID, such as R2.
Assigning one pin to multiple nets
Invalid: R1.a appears in both nets.
{"name": "SUPPLY", "pins": ["V1.p", "R1.a"]}
{"name": "OTHER", "pins": ["R1.a", "D1.a"]}
Correct it by putting R1.a in only one net. If the terminals should all be connected together, place them in the same net's pins array.
Validate and render
Validate the JSON and its terminal references before rendering:
circuit validate led.json
Validation checks the netlist structure, component IDs, pin references, and available electrical rules. It is not a circuit simulation and does not certify electrical safety.
Render a schematic to SVG:
circuit render led.json -o led.svg
Rendering also checks that CircuitGen can create an electrically verified layout and route the wires. A valid netlist may still fail to render if a collision-free layout cannot be found.