Skip to main content

Module json

Module json 

Source
Expand description

Typed JSON extraction from LLM responses.

Provides parse_json for extracting typed structs and parse_json_value for untyped JSON extraction, using a multi-strategy pipeline that handles think blocks, markdown fences, bracket matching, and JSON repair.

The _with_trace variants return a ParseTrace alongside the result for observability and debugging.

Functions§

parse_json
Parse an LLM response into a typed struct.
parse_json_value
Parse into a serde_json::Value when you don’t know the schema.
parse_json_value_with_trace
Parse into a serde_json::Value with diagnostic trace.
parse_json_with_trace
Parse an LLM response into a typed struct, returning a diagnostic trace.