Getting an LLM to return reliable JSON is two problems, not one: your prompt has to satisfy the provider’s JSON-mode requirements, and the output has to match the shape your code expects. This tool checks both — without sending anything anywhere.
How it works
OpenAI’s response_format: { type: "json_object" } mode has a quiet requirement: the word JSON
must appear somewhere in the conversation, or the API returns an error. The first check scans your
system prompt for an explicit JSON instruction and, if it is missing, gives you a ready-to-paste
rewrite that appends a clear “respond with a single valid JSON object only” line.
The second check parses your sample response and walks it against your schema sketch. The schema is
just JSON where the structure is matched recursively and each leaf is a type name — "string",
"number", "boolean", "null". Missing required keys and type mismatches are reported with their
full path (for example address.zip: expected string, got number) so you know exactly what to fix.
When to use which mode
Plain JSON mode only guarantees syntactic validity — you still have to validate the shape yourself,
which is what the schema check here mirrors. If your provider supports Structured Outputs
(json_schema with strict: true), the shape is guaranteed by the API and you can trust the keys and
types without runtime validation. Use this tool to design and sanity-check the schema before you wire
it into either path.
Tips
- Keep the schema minimal — only the keys your code actually reads. Extra keys in the response are fine and are ignored by the validator.
- For arrays, supply a single example element; every item in the response is validated against it.
- If you are on a model without native structured outputs, keep the validation in your own code too — JSON mode can still return an empty object or omit optional keys.