Prompt

JSON output AI API

Artificial Intelligence / AI Platforms1 observationLast seen Oct 8, 2026

Latest observation

Oct 8, 2026OpenAI APIWeb search: off

If you want an AI API to return JSON output, the common approach is:

  1. Ask for JSON in the prompt
  2. Use a response format / schema option if the API supports it
  3. Validate the returned JSON in your code

Example prompt

Return your answer as valid JSON with these keys:
- title (string)
- summary (string)
- tags (array of strings)

Example expected output

{
  "title": "Example",
  "summary": "A short summary.",
  "tags": ["ai", "api", "json"]
}

If you’re using an AI API with structured output support

Many modern APIs let you specify a JSON schema or “structured output” mode, for example:

  • response_format: json
  • response_format: json_schema
  • function/tool calling
  • strict structured responses

Best practices

  • Make the schema explicit
  • Tell the model to return only JSON
  • Avoid markdown fences unless you really need them
  • Validate and retry if parsing fails

Example Python check

import json

response_text = '{"title":"Example","summary":"A short summary.","tags":["ai","api","json"]}'
data = json.loads(response_text)
print(data["title"])

If you want, I can show you how to do this with a specific API like:

  • OpenAI
  • Anthropic
  • Gemini
  • Azure OpenAI
  • a custom REST API

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.