Nov. 15, 2023, 6:02 p.m. | Sergey Bolshchikov

DEV Community dev.to

During OpenAI's dev day, one of the major announcements was the ability to receive a JSON from the chat completion API. However, there aren't a few clear examples of how to do this as most examples focus on function calls.


Our objective is straightforward: given a query, we want to receive an answer in JSON format.


How can we achieve this?


There are three crucial steps.





Modify your prompt


Your prompt must explicitly specify that the response should be in …

ai announcements api chat clear dev dev day examples focus function howto javascript json major openai openai api query

Data Architect

@ University of Texas at Austin | Austin, TX

Data ETL Engineer

@ University of Texas at Austin | Austin, TX

Lead GNSS Data Scientist

@ Lurra Systems | Melbourne

Senior Machine Learning Engineer (MLOps)

@ Promaton | Remote, Europe

Research Scientist

@ Meta | Menlo Park, CA

Principal Data Scientist

@ Mastercard | O'Fallon, Missouri (Main Campus)