

How to use the ChatGPT Custom Prompt - JSON action
To ensure that ChatGPT (OpenAI) generates a JSON-formatted output, follow these best practices in your prompt:
1. Clearly Specify JSON Output
Explicitly state that the response must be in JSON format.
Example:
"Generate the response strictly in JSON format without additional text."
2. Define the JSON Structure
Provide an example of the expected structure.
Example:
"Generate a JSON object with the following structure:
{ "title": "string", "description": "string", "tags": ["string"] }
."
3. Use Explicit Field Names and Data Types
Mention required fields and expected data types.
Example:
plaintextCopyEditGenerate a JSON response with this structure: { "name": "string", "age": "integer", "email": "string", "preferences": { "theme": "string", "notifications": "boolean" } }
4. Avoid Unnecessary Explanations
Request the response without additional text before or after the JSON.
Example:
"Output only the JSON object—do not include any explanatory text."
Attached you see an example how such a prompt and system prompt might look like (1).