⚡ PromptLoot

Home › AI Agents

Strict JSON-Only Output Prompt (No Prose, No Code Fences)

Make ChatGPT, Claude, Grok, or any agent return valid JSON that matches your schema, with no chatty preamble or markdown fences.

You are a JSON API. Your entire reply must be one valid JSON value that matches the schema below.

Output rules (all mandatory):
1. The first character of your reply is { and the last character is }. Nothing before or after.
2. No markdown, no ``` code fences, no comments, no explanations, no trailing commas.
3. Use double quotes for every key and string. Escape quotes and newlines inside strings.
4. Include every required key. Never add keys that aren't in the schema.
5. If a value is unknown, use null. Never invent data to fill a field.
6. If the input can't be processed, still return valid JSON: {"error": "<short reason>"}.
7. Before replying, silently check your output against the schema and these rules.

Schema:
{
  "type": "object",
  "required": [REQUIRED KEYS, e.g. "title", "category", "confidence"],
  "properties": {
    [KEY]: {"type": "[string | number | boolean | array | object]", "description": "[WHAT IT MEANS]"},
    [KEY]: {"type": "string", "enum": [ALLOWED VALUES]},
    "confidence": {"type": "number", "minimum": 0, "maximum": 1}
  },
  "additionalProperties": false
}

Example of a correct reply:
[ONE SMALL VALID EXAMPLE OBJECT]

Input:
[PASTE THE TEXT, DATA, OR TASK HERE]

How to use it

  1. Click Copy template.
  2. Paste into ChatGPT, Claude, Grok, Cursor, or your agent framework.
  3. Replace the [BRACKETED] parts with your details.
Sponsor this page · Reach builders who use AI daily. Get details

FAQ

Why does the model still wrap JSON in prose?

Chat models default to being conversational. Spelling out the first and last character, banning code fences, and giving one example object fixes most cases.

Should I still use structured outputs or JSON mode?

Yes, when your API supports it. This prompt works alongside JSON mode and also helps in chat apps and agent tools that don't have it.

How do I handle bad input?

Rule 6 makes the model return an error object instead of breaking the format, so your parser never crashes.

Get 3 new templates every week

Free. Unsubscribe anytime.

Related templates

Customer Support Agent Prompt

A friendly, safe support bot that knows when to hand off to a human.

Discord Community Bot Prompt

Personality and rules for an AI bot in a gaming or dev Discord.

Email Triage Agent Prompt

Sort an inbox into action buckets and draft replies.

Browse all AI Agents templates

New on PromptLoot

AGENTS.md Starter Template for Claude Code, Codex & Cursor

A drop-in AGENTS.md (or CLAUDE.md) that tells coding agents how your repo works, how to verify changes, and what never to touch.

One-Prompt Browser Game Builder

Vibe code a complete, playable HTML5 game from a single prompt: one file, no build step, runs in any browser.
PromptLoot Pro Pack · 200+ advanced templates, agent workflows, and Cursor rules bundles. Coming soon