From the course: Getting Hands-On with GPT-4: Tips and Tricks

Unlock this course with a free trial

Join today to access over 23,700 courses taught by industry experts.

Formatting responses as JSON

Formatting responses as JSON

- [Instructor] Data entry and processing. It can be a very tedious task. Luckily, when generating and transforming data with GPT-4, we can specify the format of our data. One way to structure data is in the JSON format, a descriptive way of storing and sending data. Let's go ahead and ask GPT-4 to generate three recipes for us. Let's type in generate three recipes. Now, you can see here we got our recipes but they're not very structured. Let's format them in a JSON format to make them more organized. Format three recipes in a JSON format. I could also specify in my prompt to generate three recipes and specify them in a JSON format. All right, there we go. This data is much more structured. You can see here we have name, ingredients, and instructions. Now, let's ask GPT-4 to include the preparation time in a separate field here and add it to our JSON dictionary. Let's type in, make sure the preparation time is…

Contents