Sitemap can be added to a site statically if you know the URLs already or can be added dynamically if the URLs are dynamic. You can write a script to generate the sitemap.
We are all familiar with JSON but have you ever thought what are the datatypes used in the same? Check this article to learn more and get more clarity on the topic.