Interview practice question
LLM output breaks your JSON parser
Machine Learning · LLM Fundamentals · Beginner
Your application expects JSON from the LLM, but sometimes it returns extra text or invalid JSON. How do you fix it?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Use structured output / JSON schema mode.
- Validate with a schema (Pydantic); retry with error feedback.
- Clear instructions and examples.
- Lower temperature.
- Function calling as alternative.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.