Prompt

llm api structured json

Artificial Intelligence / AI Platforms1 observationLast seen Oct 8, 2026

Latest observation

Oct 8, 2026OpenAI APIWeb search: off

If you want an LLM API to return structured JSON, the common approaches are:

1) Use a JSON-only instruction

Ask the model to output only valid JSON.

Prompt example

Return only valid JSON with these fields:
- name: string
- age: integer
- skills: array of strings

Expected output

{
  "name": "Alice",
  "age": 29,
  "skills": ["Python", "SQL"]
}

2) Use schema-based output

If your API supports it, provide a schema so the model must conform to it.

Example JSON Schema

{
  "type": "object",
  "properties": {
    "name": { "type": "string" },
    "age": { "type": "integer" },
    "skills": {
      "type": "array",
      "items": { "type": "string" }
    }
  },
  "required": ["name", "age", "skills"],
  "additionalProperties": false
}

3) Validate after generation

Even with structured output, you should still:

  • parse JSON
  • validate against schema
  • retry if invalid

4) Use function/tool calling

Many LLM APIs support function calling or tools, which is often better than raw JSON prompting.

Example

{
  "name": "create_profile",
  "arguments": {
    "name": "Alice",
    "age": 29,
    "skills": ["Python", "SQL"]
  }
}

If you want, I can give you:

  • a Python example
  • an OpenAI API example
  • a JSON schema template
  • or a best-practice prompt for structured output.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.