The Problem It Solves
Getting AI to generate valid, useful UI specifications has been unreliable. Complex formats with deep nesting and strict syntax trip up language models. Open-JSON-UI takes the opposite approach—a format designed for how LLMs actually work.
Deeply nested component trees, explicit layout rules, verbose attributes—models frequently get the structure wrong, miss required fields, or produce invalid output. The deeper the nesting, the more likely the model loses track of where it is.
Complex specs mean more tokens consumed and more errors generated. You're paying more for less reliable results.
Complex specs = more tokens = more errors. 60–80% compliance at best.
Simple component types—card, form, list, text, table, chart. No deep nesting. No explicit layout rules. Just declare the content and let the renderer handle presentation.
98–100% generation reliability with OpenAI Structured Outputs. 30–50% fewer tokens than equivalent A2UI specs. The format matches how LLMs naturally think about content.
Flat format. High reliability. Fewer tokens. 98–100% compliance.
How It Works at Runtime
- App sends a request to the AI model along with the Open-JSON-UI schema as a
response_formatconstraint (Structured Outputs). This tells the model exactly what shape its output must take. - Model generates a flat JSON array of content items—cards, forms, lists, charts—with simple type/properties pairs. No deep nesting, no layout rules. Just content declarations.
- Output is validated automatically. Structured Outputs constrains the model to produce valid JSON matching the schema exactly—no hallucinated properties, no missing fields. 98–100% compliance.
- Frontend receives the validated JSON and passes it to a renderer component in your framework (React and Next.js have the strongest support today).
- Renderer maps each item to a native component. A
"type": "form"becomes your app's form component. A"type": "chart"becomes your chart library. Your styling, your design system, automatically applied. - User sees a native interface—a form, a dashboard, a data table—that looks and feels like any other screen in your app.
- User submits data. Form inputs, button clicks, and selections flow back to the AI for follow-up processing or to your backend directly.
Where Open-JSON-UI Shows Up
Open-JSON-UI is the go-to format whenever you need an LLM to generate UI reliably. Here's where it makes the biggest difference.
Chatbot Rich Responses
Instead of returning plain text, your chatbot generates cards, forms, and lists that render as interactive UI. Users get a form to fill out instead of a back-and-forth conversation.
Dynamic Dashboards
Ask your AI to "show me sales this quarter" and it generates a dashboard with charts, tables, and summary cards—all as structured JSON that your app renders natively.
Form Generation
AI generates context-aware forms based on user needs. Need to file an expense? The agent generates a form with the right fields. Need to submit a bug report? Different form, same format.
Data Visualization
The chart component type lets AI generate data visualizations as structured specifications. Bar charts, line graphs, pie charts—all described in a simple JSON format the renderer interprets.
Rapid Prototyping
When you need quick UI mockups from an AI, Open-JSON-UI's simplicity and low token cost make it ideal. Generate, iterate, and refine UI concepts at minimal cost.
Production via A2UI
Generate with Open-JSON-UI for speed and reliability, then translate to A2UI for production rendering. The SimpleA2UI layer bridges the two—best of both worlds.
Why It Matters
Think of it like giving someone a simple form to fill out instead of asking them to write HTML from scratch. The simpler the structure, the more reliable the output.
LLMs are excellent with flat structures but struggle with deep nesting. Open-JSON-UI is designed for this reality. A typical UI component takes 50–80 tokens vs 150–250 tokens for the same thing in A2UI—30–50% savings on every generation.
When paired with OpenAI's Structured Outputs, Open-JSON-UI achieves 98–100% schema compliance. The LLM is constrained to produce valid JSON that matches the schema exactly—no hallucinated properties, no missing fields.
For simpler applications, Open-JSON-UI works on its own—your client renders the JSON directly using its own component library. For production applications that need precise cross-platform rendering, a translation layer called SimpleA2UI can convert Open-JSON-UI to A2UI automatically.
Key Concepts in Plain Language
- Content-First: You describe what content to show (a card with a title, a form with fields), not how to arrange it on screen. The renderer decides layout. This matches how LLMs naturally think about information.
- Flat Structure: Components are listed in a flat array, not nested deep inside each other. This is critical—LLMs lose track of deeply nested structures, but handle flat lists reliably.
- Component Types: Seven simple types: card, form, list, text, table, chart, and widget. Each has straightforward properties. No complex inheritance or composition needed.
- Structured Outputs: When used with OpenAI's Structured Outputs feature, the LLM is constrained to produce valid JSON matching the schema—achieving 98–100% compliance in practice.
- SimpleA2UI Translation: A mapping layer that converts Open-JSON-UI to A2UI for production rendering. You get the ease of generation and the precision of rendering in one pipeline.
- Smart Clients: The renderer interprets the agent's intent and decides how to display it using native components. Different clients can render the same JSON in different ways, matching their own look and feel.
The Standard
Open-JSON-UI is optimized for the reality of LLM generation. Simple format in, reliable UI out. Use it standalone for straightforward apps, or translate to A2UI when you need production-grade cross-platform rendering.
What It Looks Like
An Open-JSON-UI response is a flat JSON structure. Here's an agent generating a contact form:
{
"type": "screen",
"content": [
{
"type": "card",
"properties": {
"title": "Contact Us",
"content": {
"type": "text",
"value": "We'll get back to you within 24 hours."
}
}
},
{
"type": "form",
"properties": {
"fields": [
{ "name": "email", "type": "email", "label": "Email Address" },
{ "name": "message", "type": "textarea", "label": "Your Message" }
],
"submitLabel": "Send"
}
}
]
}
Flat structure, no deep nesting, no layout rules. The agent describes content; the renderer decides how to display it. With OpenAI Structured Outputs, this JSON is validated against the schema automatically—achieving 98–100% compliance in practice.
Here's how you generate it with OpenAI's Python SDK:
from openai import OpenAI
from pydantic import BaseModel
from typing import List
class UIContent(BaseModel):
type: str
properties: dict
class OpenJSONUI(BaseModel):
type: str = "screen"
content: List[UIContent]
client = OpenAI()
response = client.beta.chat.completions.parse(
model="gpt-4o",
messages=[
{"role": "system", "content": "Generate UI for the user's request"},
{"role": "user", "content": "Show me a contact form"}
],
response_format=OpenJSONUI
)
ui_spec = response.choices[0].message.parsed
The response_format parameter constrains the model to produce valid Open-JSON-UI. TypeScript works the same way using Zod schemas.
How to Apply This
- • Use Open-JSON-UI when you need an LLM to generate UI specifications reliably—it's designed for how language models actually work
- • Pair it with OpenAI Structured Outputs to guarantee valid JSON schema compliance—98–100% reliability
- • For production applications, set up the SimpleA2UI translation pipeline: generate with Open-JSON-UI, render with A2UI
- • Start with simple content types (cards, lists, text) before moving to forms and charts
- • CopilotKit offers first-class support with automatic A2UI translation; the Vercel AI SDK also provides generative UI capabilities that complement Open-JSON-UI
- • React and Next.js have the strongest renderer support today, primarily through CopilotKit's integration
- • Compare token costs: Open-JSON-UI uses 30–50% fewer tokens than A2UI for the same UI, which adds up at scale
What to Watch Out For
Honest Limitations
- • Open-JSON-UI lacks explicit layout semantics. The renderer interprets how to arrange components, which means different renderers may display the same JSON differently.
- • The format is OpenAI-centric in origin and works best with OpenAI's Structured Outputs. Other LLM providers can use it but without the same schema-constrained reliability.
- • Open-JSON-UI is not a rendering protocol. For production rendering with precise control, you need A2UI. Open-JSON-UI is the generation format; A2UI is the rendering format.
- • The component set is intentionally limited (7 types). If you need highly custom UI elements, you'll need to extend the widget type or use A2UI directly.
- • Without Structured Outputs, LLMs may still produce invalid JSON. The reliability numbers (98–100%) assume you're using schema-constrained generation.
Get Started
- OpenAI Structured Outputs Guide — How to guarantee valid JSON schema compliance from LLMs
- CopilotKit Open-JSON-UI Docs — Integration guide with automatic A2UI translation
- OpenAI Structured Outputs Samples — Code examples for generating structured UI with Python and TypeScript
- CopilotKit Framework — Full-stack framework with built-in Open-JSON-UI rendering