figma-node-decoder
figma-node-decoder copied to clipboard
JSON export/import feature request
It would be nice to have a way to export/import JSON schemas instead of generating the plugin/widget code.
Maybe this can be accomplished using the nodeToObject
function for export. For import generate JSX from the exported object and then figma.createNodeFromJSXAsync
. I'm not sure if figma.createNodeFromJSXAsync
works in plugins or just in widgets.
Thank you for your plugin!
Hi @arobert93. Thanks for getting in touch. Can you tell me what you'd like to do with the JSON schema after it's been exported? Have you tried using nodeToObject
already? What is it about this that doesn't suit your needs? And just to clarify, would you like the plugin to export a JSON schema (or the JavaScript API)?
Thanks for your feedback!
Hi @gavinmcfarland, I'm planning to store the Figma nodes is a db. I haven't tried to nodeToObject
yet, but it should work. It would be nice for Figma to introduce a feature createJSXAsyncFromNode
kind of function. I would like the JS API to have this to be able to build my own plugin on top of it.
Thanks @arobert93. I know where you're coming from now. It's something I've thought about. I'll let you know if and when I get around to experimenting with this. My only worry is that things are changing so quickly with Figma that what I create may go out of date pretty quickly.
@gavinmcfarland Sure, understandable. It could be a nice feature if Figma would actually expose this by default since they are using it internally to store the page information.