llama.cpp added context-free grammar guided generation functionality. It requires passing a file in a derivative of BNF notation, which gets messy very quickly for things like JSON.
To improve the experience, we built a small compiler from TypeScript interfaces to the grammar file format and have it hosted in a little browser app.
See more in discussion at https://github.com/ggerganov/llama.cpp/discussions/2494