Import JSON into the Canvas

You can load a JSON document directly into the canvas to rebuild a scene.

  • Call editor.loadData({ objects }) with the JSON payload.
  • Ensure each object has id, type, transform, and visibility fields.
  • Optional: include a variables block to import theme tokens (collections, variables, activeModes).

For server-side previews, use the Node renderer:

  • Run agent/render-demo.ts with the JSON input and output PNG.
  • The renderer uses @designful/editor-node so it works without a browser.

You can also render on demand with the local API:

  • POST /api/render-json
  • Sends a JSON payload with objects (and optional canvas).
  • Returns a PNG buffer.

Tip: Keep the JSON in source control so the preview image can be regenerated when the data changes.