ChatGPT

Verified against ChatGPT · 2026-07-31

Get ChatGPT's chat interface to emit JSON reliable enough to feed into a script

Builds a JSON-output contract for the consumer ChatGPT app — where there is no schema-enforcement toggle the way the API has — with an explicit self-check step, since the chat interface's adherence depends entirely on how rigorously the prompt itself specifies and validates the shape.

ChatGPT (GPT-5.1)4 fillable variables

The prompt

Ready to copy — highlighted parts are example details you can swap.

You are producing JSON output from inside the ChatGPT chat interface that will be copied directly into a script — there is no schema-validation layer here the way there is calling the API with a response_format; the only thing enforcing the shape is this prompt and your own self-check before showing the output.

SOURCE CONTENT TO CONVERT
A block of freeform customer feedback text pasted from a support ticket, needing conversion into a structured sentiment record.

TARGET SCHEMA
{ "ticket_id": string, "sentiment": "positive" | "neutral" | "negative", "topics": string[], "urgency_score": number (1-5) }

FIELDS THAT CAN BE NULL VERSUS FIELDS THAT MUST ALWAYS HAVE A VALUE
ticket_id and sentiment are required, never null. topics can be an empty array if nothing specific was mentioned. urgency_score defaults to 1 if nothing suggests urgency.

WHAT THE DOWNSTREAM SCRIPT DOES WITH THIS
A Python script that loops over these objects and inserts each one as a row into a Postgres table — it will throw on a missing required key.

OUTPUT RULES
Produce only the JSON object — no prose before it, no explanation after it, no markdown code fence unless explicitly requested — since a downstream script parsing this output with a direct JSON parser will fail on any leading or trailing text, and a friendly one-line introduction before the JSON is enough to break a naive parse. Match the target schema's field names, nesting, and types exactly — if the schema says a field is a number, do not return it as a numeric-looking string, and if it says an array, do not collapse a single-item result into a bare object instead of a one-element array, since a downstream script written against the schema will branch on the type it expects and silently mishandle the type it actually got, often without throwing an error at all. Follow the nullable-versus-required distinction exactly — a required field with genuinely no value in the source content should get an explicit sentinel value agreed on in advance, not be omitted from the object entirely, since an omitted key and a null value are different things to most parsers and omission is more likely to throw an unhandled key-error downstream than a null read would. Before producing the final output, do a self-check pass that the JSON is syntactically valid — matched braces and brackets, no trailing commas, all strings properly quoted and escaped — and silently fix anything found, rather than showing output that hasn't been checked. If any part of the source content doesn't map cleanly onto the schema, do not silently drop or coerce it; stop and ask before generating the object, since a downstream script trusting a schema it thinks was followed exactly has no way to detect a silent, plausible-looking deviation on its own.

OUTPUT FORMAT
The JSON object exactly as specified above, and nothing else, unless something needed flagging per the last rule, in which case flag it before producing any JSON at all rather than producing a guessed version alongside the flag.

Customize

Optional — swap in your own details for the highlighted parts above.

Why this works

The consumer ChatGPT chat interface has no equivalent of the API's response_format json_schema parameter, which actually constrains token generation to a valid schema at the decoding level — in the chat app, JSON output is just regular text generation that happens to look like JSON, so its validity depends entirely on the model choosing to follow the instructed shape, which is exactly why an explicit self-validation step before the final output matters here in a way it wouldn't if this were an API call with structured outputs enforced by the platform itself. The no-prose, no-fence instruction targets a specific and extremely common default: ChatGPT's conversational tuning makes it want to introduce output with a friendly lead-in sentence even when asked for "just the JSON," and a script parsing a string that starts with "Sure, here's the JSON:" throws immediately, a failure that has nothing to do with whether the JSON itself was correct. The omission-versus-null distinction is a real and common source of downstream bugs: most JSON consumers treat a missing key and a key present with a null value differently — a script that does a direct key lookup throws on omission but returns cleanly on an explicit null — so an instruction that only says "handle missing values" without specifying which behavior is wanted leaves that choice to the model's default, which is inconsistent across cases and turns into an intermittent bug. Requiring an explicit stop when the source content doesn't map cleanly onto the schema, rather than a silent best-effort coercion, matters because a script trusting a stated schema has no independent way to verify the model actually honored it — a plausible-looking but silently wrong type coercion will pass a naive downstream insert without error and corrupt the row's meaning in a way nobody will notice until much later, if ever.

Verified against

ChatGPT GPT-5.1 · 2026-07-31

Changelog

  • 2026-07-31 — Initial publish, verified against ChatGPT GPT-5.1 chat interface (no API structured-output enforcement).

Building this for real?

This is a free starting point. If you'd rather have what Scult builds built and running for your business, that's Scult's day job.

EXPLORE WHAT SCULT BUILDS
All ChatGPT prompts

Check your AI visibility

One URL in, a 0–100 score and the exact fixes out.

RUN THE CHECK

Browse all the tools

15 tools across six categories
13 of them never send your data anywhere

Free · No signup · No trial clock

SEE THE DIRECTORY