All Lessons

What is JSON mode in the Messages API?

1 / 2
intermediate 20 min

JSON Mode

Loading lesson content...

A developer enables JSON mode but still gets invalid JSON sometimes. The model's response includes markdown formatting around the JSON. What's wrong?

1 / 2

A parser downstream of JSON mode often fails because Claude outputs comments within JSON (which is not valid JSON). What's the fix?

1 / 2