You can use structured outputs to tell ChatGPT-4o to create specific JSON matching a schema: https://platform.openai.com/docs/guides/structured-outputs/i...
It's a bit annoying because the schema has some limitations but it works with enough elbow grease