Skip to content

Instantly share code, notes, and snippets.

@spech66
Last active April 6, 2023 05:30
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Let OpenAI chatgpt-4 output data in JSON and CSV format

ChatGPT allows specifying output formats like JSON or CSV. Test at the OpenAI Playground.

JSON

USER

Classify the following items as fruit or vegetable: apple, banana, cucumber.
Output the data as JSON in the format [{"name": "Apple", "type": "Fruit/Vegetable"}]

ASSISTANT

[{"name": "Apple", "type": "Fruit"}, {"name": "Banana", "type": "Fruit"}, {"name": "Cucumber", "type": "Vegetable"}]

CSV

USER

Classify the following items as fruit or vegetable: apple, banana, cucumber. Output the data as CSV in the format "name", "type"

ASSISTANT

"apple", "fruit"
"banana", "fruit"
"cucumber", "vegetable"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment