Parse Partial JSON While Streaming

hard
Unit 29 · Safety0/0 to milestone

When a model streams JSON, the UI wants to show fields as they arrive, but json.loads fails on every incomplete prefix. Write a tolerant parser for a JSON prefix.

Pro problem

Unlock this and every premium problem across all tracks — plus hidden-test grading, advanced AI engineering modules and new content every week.

Start 7-day free trial
solution.py · Python 3.13
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Parse Partial JSON While Streaming · TechGradify