Skip to content

User Guide

md2pydantic supports three input formats, each with a dedicated parsing method.

Markdown Tables

Pipe-delimited tables are parsed row-by-row into a list of model instances. Headers become field names.

See Markdown Tables.

JSON Blocks

Fenced (```json) and inline {...} JSON blocks are extracted and validated. Includes recovery for common LLM quirks like trailing commas and unquoted keys.

See JSON Blocks.

YAML Blocks

Fenced (```yaml) blocks are extracted and validated. Requires the pyyaml dependency.

See YAML Blocks.

Auto-Detect

The parse() method tries code blocks first, then falls back to tables. Use it when you do not know the format in advance.

See Auto-Detect.

Additional Topics