> How is memory for JSON allocated on stack?

Check the features section (https://aardappel.github.io/goose/#features), which starts off with how memory works.