Make It Return JSON

structured JSON output

Part of: Meeting Notes to Action Items

Pipe-delimited lines got us this far, but they're fragile. What if a task itself contains a pipe? What if you later want a fourth field like priority? Delimited text falls apart. The standard shape for structured model output is JSON , and switching to it is what takes this product from a demo to something you'd actually run. Ask for JSON, precisely You get JSON by asking for JSON and describing the exact schema, keys included. Show the model the shape you want: Now one call returns all the items as a list of dicts, exactly the structure your code wants. The model wraps its JSON, deal with it Even when you say "only JSON", models often wrap it in chatty text or a Markdown code fence like \\\json ... \\\. A raw json.loads on that reply throws. The fix is to grab the JSON array out of whatever surrounds it by finding the first [ and the last ]: Use find/rfind, not index/rindex: find returns -1 when there is no bracket instead of raising, so the -1 check lets a reply with no array fall through to an empty list rather than crashing. This one guard handles most of what goes wrong with structured output. It survives code fences, a leading "Here are the items:", and a trailing "Hope that

Challenge: Validate the JSON Items