| Crates.io | fig2json |
| lib.rs | fig2json |
| version | 0.3.0 |
| created_at | 2025-11-10 12:26:50.060955+00 |
| updated_at | 2025-11-14 21:27:25.794765+00 |
| description | CLI tool to convert Figma .fig files to LLM-friendly JSON format |
| homepage | |
| repository | https://github.com/kreako/fig2json |
| max_upload_size | |
| id | 1925387 |
| size | 689,593 |
Convert Figma .fig files to clean, optimized JSON for AI-powered design implementation.
fig2json extracts and transforms Figma design files into structured JSON, making it easy for LLMs to understand and implement your designs. The tool removes Figma-specific metadata and applies intelligent transformations to produce JSON optimized for HTML/CSS conversion.
In Figma, go to the top-left menu:
.fig file to your computerRun fig2json on your saved file:
fig2json your-design.fig output-directory
This will:
output-directory/output-directory/canvas.jsonAsk your LLM to implement the design:
Implement the design found in output-directory/canvas.json
The clean JSON structure makes it easier for AI to understand your design and hopefully generate accurate HTML/CSS.
Tip: For easier LLM consumption, consider using jq to extract specific parts of the design or to further process the JSON before sending it to your LLM.
cargo install fig2json
Or build from source:
cargo build --release
# Binary will be at target/release/fig2json
Convert a .fig file and extract to a directory:
fig2json design.fig output-dir
Convert a .fig file to stdout:
fig2json design.fig
Convert to a specific output file:
fig2json design.fig -o output.json
| Flag | Description |
|---|---|
-o, --output <FILE> |
Output JSON file path (default: stdout). Cannot be used with extract directory mode. |
--compact |
Output compact JSON instead of pretty-printed (default is indented). |
-v, --verbose |
Enable verbose output for debugging. |
--raw |
Generate both transformed .json and raw .raw.json files. The raw version contains the original data without transformations. |
Extract and convert with verbose output:
fig2json design.fig output-dir --verbose
Compact JSON output:
fig2json design.fig -o compact.json --compact
Generate both transformed and raw JSON:
fig2json design.fig output-dir --raw
# Creates: output-dir/canvas.json and output-dir/canvas.raw.json
Pipe to other tools:
fig2json design.fig | jq '.document.children[0]'
The tool applies intelligent transformations to clean up the JSON:
blendMode: "NORMAL", default letter spacing, line heightinternalOnly elementsUse the --raw flag to also generate the untransformed JSON for comparison.
After extraction, you'll find:
output-directory/
├── canvas.json # Main design file (transformed)
├── canvas.raw.json # Raw untransformed data (if --raw flag used)
└── [other extracted files]
The canvas.json file contains the complete design tree with all layers, styles, and properties needed for implementation.
This project was inspired by Evan Wallace's Figma File Parser.
This project was mostly vibe-coded with Claude Code.
--raw flag): Original decoded data with all Figma-specific fields intact. Useful for debugging or advanced use cases.No, this tool works with locally saved .fig files. You need to use Figma's "Save local copy" feature to export the file first.
MIT