Convert whole figma document into JSON

Hi community,

i would like to create a plugin which works like a template and adds a specific page structure aswell as already a bunch of content (Components, Frames etc.)

Is there a way to easily convert a whole Figma document into a format which then can be loaded via plugin?. I have seen that there are multiple plugins which convert single objects into JSON, but none for the whole document.

Thanks alot.