https://openai.com/blog/function-calling-and-other-api-updat...
Here's a project that promises to deliver valid JSON every time:
https://news.ycombinator.com/item?id=37125118
Or you could attempt to parse the results yourself, and if it fails, feed the error message back to the LLM and have it try again.