json-render explained: Vercel's generative UI library

json-render is an open source library from Vercel for generative UI. You define a catalog of your own components with typed props, a model returns a JSON spec that uses only those components, and json-render renders it natively in your app. The model never writes markup, so the screen cannot contain anything you did not ship.

By Alex DeanUpdated

What is json-render?

json-render is an open source library from Vercel Labs for building generative UI. You define a catalog of your own components and the props each one takes. A model returns a JSON spec that references only those components, and json-render renders the screen from that spec. The model never writes markup, so the page cannot contain anything you did not ship.

It sits in the middle of the three ways to generate an interface: a model choosing from a catalog, between hand-written rules and a model writing the markup itself. The code is on GitHub under the Apache 2.0 license, and InfoQ covered the release in March 2026.

How does json-render work?

The json-render docs describe the loop in five parts.

  1. Define a catalog. You call defineCatalog with a schema from the renderer you use. Each component gets props written as zod schemas and a description the model reads when it chooses. You can also declare named actions, such as “export report”.
  2. Prompt the model. catalog.prompt() turns the catalog into a system prompt: every component, its props and the actions available. You pass that to the model with the request.
  3. The model returns a spec. A spec is flat JSON: a root id and an elements map, where each element has a type from the catalog, its props and the ids of its children.
  4. Stream it. The model can send the spec as it goes, one JSON Patch operation per line. The docs call this format SpecStream. Each line adds to the spec and the screen updates as lines arrive.
  5. Render. A registry maps each catalog name to a real component, and a Renderer draws the spec with it. The output is native UI in your app, with no iframe and no generated code.

The flat shape is deliberate. A nested tree is hard to validate until it is complete, while a map of elements can be checked and drawn one element at a time as it streams.

Renderers exist for React, Vue, Svelte, Solid and React Native, plus targets such as PDF, email and video, and full Next.js apps. A spec can also carry state: $state reads a value, visible shows or hides an element on a condition, and components fire catalog actions through emit.

Example: a catalog and a spec

Say a product page has a slot under the price, and you want a model to fill it. The catalog below is a sketch in the shape of the README example: two components, each with typed props and a description.

import { defineCatalog } from "@json-render/core";
import { schema } from "@json-render/react/schema";
import { z } from "zod";

const catalog = defineCatalog(schema, {
  components: {
    PricingCallout: {
      props: z.object({
        headline: z.string(),
        plan: z.enum(["free", "team", "enterprise"]),
      }),
      description: "Answers a cost question next to the price",
    },
    CompareTable: {
      props: z.object({ productIds: z.array(z.string()) }),
      description: "Side-by-side comparison of products the visitor viewed",
    },
  },
  actions: {
    open_pricing: { description: "Open the pricing page" },
  },
});

A spec the model could return for a visitor who keeps going back to pricing:

{
  "root": "slot-1",
  "elements": {
    "slot-1": {
      "type": "PricingCallout",
      "props": { "headline": "The free tier covers this page's use case", "plan": "free" },
      "children": []
    }
  }
}

Streamed, the same spec arrives as patch lines, such as {"op":"add","path":"/root","value":"slot-1"} followed by one line that adds the element. On the client, defineRegistry(catalog, { components }) maps PricingCallout to your real component and <Renderer spec={spec} registry={registry} /> draws it. If the model names a component that is not in the catalog, there is nothing to map it to.

How does json-render compare with A2UI, MCP Apps and other options?

Every option here lets a model influence what the user sees. They differ in what the model sends, where the result renders and who owns the components. Each row is summarized from the project’s own documentation, linked in the first column.

Option What the model sends Where it renders Who owns the components Best fit
json-render A flat JSON spec, optionally streamed as JSON Patch lines Natively in your app: React, Vue, Svelte, Solid, React Native and more You, through the catalog Your own pages, dashboards and screens composed per request
A2UI Declarative JSON component descriptions, streamed Client renderers such as Angular, Flutter and Lit The client, through its catalog of approved components Agents that serve UI to many clients, often over the A2A protocol
MCP Apps A tool that points to a ui:// resource holding an HTML page A sandboxed iframe inside the host, such as Claude or VS Code The MCP server author Interactive tools inside chat and agent hosts
AI SDK UI generative interfaces Tool calls with typed inputs; your code maps each tool to a component Your React app You, one component per tool Chat interfaces where each tool has a fixed view
AI SDK RSC streamUI Streamed React Server Components Next.js apps using server components You Experimental; its docs recommend AI SDK UI for production
CopilotKit Tool calls that render components you registered The copilot chat in your app You In-app copilots and assistants

Two lines separate them. MCP Apps and A2UI are protocols for a host or agent you may not control, while json-render and the AI SDK are libraries inside your own app. And tool-based approaches give each tool one fixed view, while json-render lets the model compose a layout from several components. The options also combine: json-render ships an @json-render/mcp package for MCP Apps, and its streaming example uses the AI SDK’s streamText on the server.

When should you use json-render?

json-render fits when the screen is yours and the model’s job is to arrange it.

  • Your own app, your own components. You already have a design system and want a model to pick and fill components from it, on brand and accessible because you built them.
  • Layouts nobody wrote a rule for. The number of cases has outgrown hand-written rules, the point where most teams move part of the decision to a model.
  • Several platforms from one spec. The same catalog idea renders on web and React Native.
  • Streaming matters. A long spec can start drawing before the model finishes.

It is a poor fit in four cases. If the UI lives inside someone else’s host, such as a chat client, MCP Apps or A2UI are built for that boundary. If each tool needs one fixed view, a tool-based approach is simpler. If the choices are few and stable, rules over a component list are cheaper and easier to test, and a plain server-driven UI does the job. And if you need markup the catalog cannot express, json-render will not produce it, by design.

What json-render does not decide

json-render draws; it does not decide. Something upstream chooses what goes in the spec: a rule, a general model, or a model built for fast typed choices. That choice is only as good as what the model knows about the visitor. A spec composed from the route and the props alone comes out the same for everyone, the way a template does. Building generative UI with an AI agent covers the decision step, and why generative UI needs real-time state covers the input.

Where Signals fits

Signals renders nothing and picks nothing. It supplies the state: what this visitor is doing in the current session, computed from their behavioral events and returned as JSON for the model’s prompt. The pricing visits behind the example above could be an attribute like this, keyed on the session:

from snowplow_signals import Attribute, Event, StreamAttributeGroup, domain_sessionid

pricing_view = Event(name="pricing_view", vendor="com.example", version="1-0-0")

pricing_views_session = Attribute(
    name="pricing_views_session",
    type="int32",
    events=[pricing_view],
    aggregation="counter",
    default_value=0,
)

page_slots = StreamAttributeGroup(
    name="page_slots",
    version=1,
    attribute_key=domain_sessionid,
    owner="you@example.com",
    attributes=[pricing_views_session],
)

The model reads that value, chooses PricingCallout, and json-render draws it. You can build the same input on your own event stream, and use json-render with any source of state. The generative UI topic covers the rest of the pattern.

See it on your own traffic

Add the SDK, define one attribute, and see an attribute updating against your own traffic in the first session. The free tier runs on the real engine: no card, no sales call.