All entries

    Structured LLM Extraction with JSON Schema and Validation

    Validate the shape and meaning of an LLM extraction result before it enters a product catalogue.

    A workstation routes document fields through validation checks
    Conceptual pixel-art illustration.

    Validate the shape and meaning of an LLM extraction result before it enters a product catalogue.

    Build the example

    Use a synthetic label that says “length 25 cm, net mass unlisted.” Define a schema for value, unit and optional evidence, and require an explicit null for unknown mass. Validate the JSON against the schema, then normalize known units and run domain checks such as nonnegative dimensions. Retain the original excerpt.

    Define one passing fixture as length 25 cm with exact source text and unknown mass. Define two failing fixtures that swap field names or omit evidence. Validate all three after updating a model or parser. The fixture set checks both the output schema and the consumer’s interpretation of the extracted values.

    EXPLAINED / SYSTEM FLOW

    Three gates for extracted fields

    Validate the shape and meaning of an LLM extraction result before it enters a product catalogue.

    Example

    1. Schema

      verify required fields and types

    2. Domain

      check units and range

    3. Evidence

      verify the excerpt supports the field

    THE KEY DISTINCTION

    verify the excerpt supports the field

    Conceptual diagram for the synthetic example in this guide.

    Watch the failure boundary

    A good error report names the field and the rule that failed. Record the parse failure independently from failed evidence checks. This makes it possible to see whether a schema change improves formatting while leaving accuracy untouched. Keep a small fixture file of known malformed, unsupported and valid outputs for later model upgrades.

    Verify the behavior

    Try valid JSON that gives a length of -25 cm, or a model that assigns 25 cm to the width field. A well-formed answer can still fail the business rule or cite the wrong evidence. Route the result for correction and keep the valid length separate from fields that failed.

    FURTHER READING

    Sources

    Technical references checked .

    END OF ENTRY / 49
    Eeshan Singh with Big Ben in London
    BEHIND THE JOURNAL

    Eeshan Singh

    I’m Eeshan Singh Pokharia, an AI Full Stack Developer and CoFounder of UltraFit360. I work across AI features, full-stack product development, and web and mobile experiences—from Figma and frontend interactions to the systems behind them.

    A good error report names the field and the rule that failed. Record the parse failure independently from failed evidence checks. This makes it possible to see whether a schema change improves formatting while leaving accuracy untouched. Keep a small fixture file of known malformed, unsupported and valid outputs for later model upgrades.

    Meet the author
    THE CONVERSATION

    Your side of the story.