Structured Outputs with LLMs: JSON Mode, Function Calling, and When to Use Each

📰 Towards Data Science

Learn how to use JSON mode and function calling with LLMs to generate structured outputs and when to use each approach

intermediate Published 18 Jun 2026
Action Steps
  1. Use JSON mode with LLMs to generate structured outputs by providing a JSON object as input and specifying the desired output format
  2. Implement function calling with LLMs to generate structured outputs by defining a function that takes input and returns output in a specific format
  3. Compare the advantages and disadvantages of JSON mode and function calling to determine which approach to use for a given task
  4. Apply JSON mode and function calling to real-world problems, such as data processing and generation, to see the benefits in practice
  5. Test and evaluate the performance of LLMs using JSON mode and function calling to identify areas for improvement
Who Needs to Know This

Data scientists and machine learning engineers can benefit from this knowledge to improve the performance and usability of their LLM models

Key Insight

💡 JSON mode and function calling are two approaches to generate structured outputs with LLMs, each with its own strengths and weaknesses

Share This
🤖 Use JSON mode and function calling with LLMs to generate structured outputs and improve model performance! #LLMs #JSONmode #functioncalling

Key Takeaways

Learn how to use JSON mode and function calling with LLMs to generate structured outputs and when to use each approach

Full Article

Title: Structured Outputs with LLMs: JSON Mode, Function Calling, and When to Use Each

URL Source: https://towardsdatascience.com/structured-outputs-with-llms-json-mode-function-calling-and-when-to-use-each/

Published Time: 2026-06-18T18:00:00+00:00

Markdown Content:
# Structured Outputs with LLMs: JSON Mode, Function Calling, and When to Use Each | Towards Data Science

![Image 1: Revisit consent button](https://cdn-cookieyes.com/assets/images/revisit.svg)

We value your privacy

We use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking "Accept All", you consent to our use of cookies.

Customise Reject All Accept All

Customise Consent Preferences![Image 2](https://cdn-cookieyes.com/assets/images/close.svg)

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorised as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ...Show more

Necessary Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

* Cookie BCTempID
* Duration 10 minutes
* Description No description available.

* Cookie __cf_bm
* Duration 1 hour
* Description This cookie, set by Cloudflare, is used to support Cloudflare Bot Management.

* Cookie AWSALBCORS
* Duration 7 days
* Description Amazon Web Services set this cookie for load balancing.

* Cookie _cfuvid
* Duration session
* Description Cloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services

* Cookie li_gc
* Duration 6 months
* Description Linkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.

* Cookie __hssrc
* Duration session
* Description This cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.

* Cookie __hssc
* Duration 1 hour
* Description HubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.

* Cookie wpEmojiSettingsSupports
* Duration session
* Description WordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.

* Cookie BCSessionID
* Duration 1 year 1 month 4 days
* Description Blueconic sets this cookie as a unique identifier for the BlueConic profile.

* Cookie _octo
* Duration 1 year
* Description No description available.

* Cookie logged_in
* Duration 1 year
* Description No description available.

* Cookie __Secure-YEC
* Duration past
* Description YouTube sets this cookie to stores the user's video player preferences using embedded YouTube video

* Cookie __eoi
* Duration 6 months
* Description Description is currently not available.

* Cookie AWSALBTGCORS
* Duration 7 days
* Description No description available.

* Cookie login-status-p
* Duration past
* Description Description is currently not available.

* Cookie AWSALBTG
* Duration 7 days
* Description No description available.

* Cookie csrf_token
* Duration session
* Description No description available.

* Cookie token_v2
* Duration 1 day
* Description Description is currently not available.

* Cookie D
* Duration 1 year
* Description Description is currently not available.

* Cookie PHPSESSID
* Duration session
* Descript
Read full article → ← Back to Reads

Related Videos

5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Claude Fable 5: AI Benchmarks Shattered! #shorts
Claude Fable 5: AI Benchmarks Shattered! #shorts
Income stream surfers
ANTHROPIC COOKED: Claude Fable 5: It's ACTUALLY Over (INSANE)
ANTHROPIC COOKED: Claude Fable 5: It's ACTUALLY Over (INSANE)
Income stream surfers
Claude vs ChatGPT for Programming: What's the difference?
Claude vs ChatGPT for Programming: What's the difference?
Adrian Twarog
How to integrate OpenAI GPT3 with a Databases - Crash Course
How to integrate OpenAI GPT3 with a Databases - Crash Course
Adrian Twarog
What is GPT4 and How You Can Use OpenAI GPT 4
What is GPT4 and How You Can Use OpenAI GPT 4
Adrian Twarog