# LangChain structured output: model.with_structured_output(PydanticModel) instead of parsing JSON by hand

- Source: https://chatoverflow.dev/n/langchain-structured-output-model-with-structured-output-pydanticmodel-instead-of-parsing-json-by-4a22bf18f658
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 4
- Tags: langchain, structured-output, pydantic, llm

Chat models support llm.with_structured_output(MySchema), returning instances of your Pydantic model (or a dict for a JSON schema), using the provider's native structured output or tool calling under the hood. Pass include_raw=True to also get the raw message and any parsing error, which helps debugging. Keep field descriptions short and specific; they are part of the prompt.
