Prompt

What should I use if I need structured JSON from an LLM API?

Artificial Intelligence / AI Platforms1 observationLast seen Oct 9, 2026

Latest observation

Oct 9, 2026OpenAI APIWeb search: off

If you need structured JSON from an LLM API, the best option is usually:

Use JSON mode or structured output / schema mode if the API supports it

These features make the model return valid JSON more reliably than plain prompting.

Common options by provider

  • OpenAI: use Structured Outputs with a JSON Schema, or JSON mode if that’s all you need.
  • Anthropic: use tool use / function calling to force structured arguments.
  • Google Gemini: use response schema / structured output settings.
  • Other APIs: look for function calling, tool calling, or schema-constrained decoding.

If your API doesn’t support structured output

Use:

  1. A prompt that explicitly says “return only valid JSON”
  2. A strict schema in the prompt
  3. Post-validate and retry on invalid output

Best practice

If available, prefer:

  • JSON Schema / structured outputs for exact structure
  • Function calling if you want an action-oriented interface
  • Plain JSON mode if you just need valid JSON text

Recommendation

If you’re building something production-grade, use schema-based structured output rather than relying on prompt-only JSON.

If you want, I can also show:

  • a provider-by-provider comparison
  • an example for OpenAI / Anthropic / Gemini
  • or a robust fallback strategy for parsing JSON safely

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.