I am creating custom Figma plugin with JS, so, I receive data from the backend and want to convert it to a node so that it appears in the design. But actually I can not find methods of Figma API to release this idea.
Here JSON which I receive from my API
thank you for answer, but I already read the documentation and can’t find the way to transform my json in picture, to frame in design
yes, there is a very simple example, while this object has a lot of methods, I would like to find a live example of creating a frame that covers the entire stream, affecting all the fields that it can take, ask why I ask such small questions, but since some of these fields are read-only, some are generated, some are added not by direct assignment, but by calling certain methods, all this breaks my brain and I cannot create a frame in which absolutely all fields are filled, but while we communicate inside the frame , there are other types of nodes that the frame itself can take into a child field that also don’t have a fully scoped example, which is why I try so hard to find a live example
Just in case, there is also this method: createNodeFromJSXAsync | Plugin API (not sure if it would be useful in your case but it might be)
There are no “JSON to frame” methods. In general, you would need to do something like this:
const frameJSON = {} // your frame json
const frame = figma.createFrame()
frame.fills = frameJSON.fills
frame.strokes = frameJSON.strokes
frame.resize(frameJSON.width, frameJSON.height)
// ... etc
You can also search for “figma node from json” or something like that on github, I believe there might be a library for that to use as a starting point.