Figma Variables to JSON

Hi! Does anyone know how to prepare variables correctly in Figma and after that export it as a JSON file?
Looking for the easiest and developer friendly way of doing it