JSON schema

A formal description of the shape of a JSON document — keys, types, required fields, allowed values — used to constrain and validate model output.

Last updated: · Markdown version

How to apply it in prompts

Use this concept to reduce ambiguity and improve consistency. If you need strict formatting, combine it with a JSON guide and a per-model template.

What it means
Copy-paste example
Extract the order from the text. Return ONLY JSON that matches this schema:
{"orderId":"string","items":[{"sku":"string","qty":"number"}],"notes":"string|null"}
If a field is missing in the text, use null. Do not guess.

Text:
"""[paste]"""
Opens the analyzer with the prompt prefilled.
Open in Promptea
FAQ
Is the schema in the prompt enough to guarantee valid JSON?
It makes valid JSON likely, not certain. For guarantees use the provider's structured-output feature where available and validate the result in code.
Should I ask for markdown code fences around the JSON?
Not if a program reads it: say 'return ONLY JSON, no markdown' so the output can be parsed directly.