When a reasoning model's <think> block leaks a JSON draft into your parser

Disclosure: I wrote this article together with an AI assistant (Claude). The AI ran all the code below and checked the results. I am not a professional programmer, so please read it with that in mind. The problem When you pull JSON out of an LLM's reply, json.loads raising an error is the easy case.

Source: DEV Community

Read the full article at the source.

Read on DEV Community