Skip to main content
September 15, 2023
Solved

Get text from component using REST API

  • September 15, 2023
  • 3 replies
  • 1614 views

Can I extract a text from a component using the REST API? I have a chat baloon component and I want to extract the text from it. As of now, the only solution I found was to create a Python script where I get a JSON of my file, get the component, get the {thumbnailurl}, save the png, use an OCR to extract a text from the png. But, the OCR is returning not so good results and I want to know if there is a simpler solution to it

This topic has been closed for replies.
Best answer by tank666

Find the required node in the JSON response, look at its children, find an object with the TEXT type and the characters property.

3 replies

tank666
September 15, 2023
UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
September 15, 2023

Thanks for the reply! But how could I then extract the text content from there?

tank666
tank666Solution
September 15, 2023

Find the required node in the JSON response, look at its children, find an object with the TEXT type and the characters property.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank