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

Lecturer in Social Data Analytics

@ The University of Hong Kong | Hong Kong

careerstart@sas data scientist intern

@ SAS | Tervuren, Belgium

Applied Scientist - Conversational AI, Analytics and Data Management

@ Amazon.com | Seattle, WA, USA

Senior Perception & Autonomy Researcher

@ Draper | Cambridge, MA, United States

Lead ML & AI Engineer

@ HERE Technologies | Navi Mumbai, India

Data Scientist - Sr. Consultant level ( 9Yrs to 11yrs, TensorFlow , Python,R , Bigdata)

@ Visa | Bengaluru, India