I shipped a feature that sends a photo to a vision model and gets back structured feedback — three labeled fields, every time, no exceptions. The hard part wasn't the prompt. It was getting the model to return JSON I could actually trust without writing a defensive parser around every call.

If you've ever written this, you know the pain:

const text = response.choices[0].message.content;

const json = JSON.parse(text); // 🙏 please be valid

Enter fullscreen mode