How do i get the component using component ID

Run time components can't be saved to text files.
Represent the contents and structure in JSON text, and save that text.