# LangChain: Structured Output with JavaScript

DevFeed: [LangChain: Structured Output with JavaScript](<https://devfeed.tech/articles/langchain-structured-output-with-javascript-18945.md>)

Original publisher: [Read original article](<https://www.robinwieruch.de/langchain-javascript-structured/>)

Author: Robin Wieruch

Published: 2025-01-27T06:52:46Z

Content type: tutorial

Language: en

Sources: [Robin Wieruch](<https://devfeed.tech/sources/robin-wieruch.md>)

Topics: [LangChain](<https://devfeed.tech/topics/langchain.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [Structured-data](<https://devfeed.tech/topics/structured-data.md>), [Next.js](<https://devfeed.tech/topics/next-js.md>), [React](<https://devfeed.tech/topics/react.md>), [API](<https://devfeed.tech/topics/api.md>), [Back end](<https://devfeed.tech/topics/backend.md>), [Front end](<https://devfeed.tech/topics/frontend.md>), [OpenAI](<https://devfeed.tech/topics/openai.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [langchain](<https://devfeed.tech/tags/langchain.md>), [langchain-javascript-structured-output](<https://devfeed.tech/tags/langchain-javascript-structured-output.md>), [next-js](<https://devfeed.tech/tags/next-js.md>), [react](<https://devfeed.tech/tags/react.md>), [schema](<https://devfeed.tech/tags/schema.md>), [structured-output](<https://devfeed.tech/tags/structured-output.md>), [validation](<https://devfeed.tech/tags/validation.md>), [zod](<https://devfeed.tech/tags/zod.md>)

## AI overview

This tutorial demonstrates how to build structured-output responses with LangChain in JavaScript. It uses Next.js and React for the application, the OpenAI API for chatbot responses, and Zod to define and validate a shared schema between the backend and frontend.

## Source excerpt

How to: Structured Output in JavaScript with LangChain. A step by step example on how to use structured data in JavaScript with LangChain ...