AB
AiBoss
project

json-render - Vercel's open-source, controllable AI-generated UI rendering solution

json-render is an open-source project by Vercel that solves the problem of uncontrollable AI-generated UIs. json-render defines a Catalog to constrain AI to only generate JSON data conforming to a specific schema, using...

What is json-render?

json-render is an open-source project by Vercel that solves the problem of uncontrollable AI-generated UIs.json-renderBy defining a Catalog, the AI is constrained to generate only JSON data conforming to a specific schema, and the JSON is rendered into the UI using a front-end component library. The core mechanism includes Catalog definition, streaming rendering, and reverse engineering of source code, supporting real-time feedback and efficient development.json-renderIt is applicable to various scenarios such as data analysis dashboards and dynamic forms, and promotes the transformation of developers from writing page code to building component libraries and rules. It is an important innovation combining AI and front-end development.

The main functions of json-render

  • Constrained generationBy defining a Catalog, the AI is restricted to using only specified components and properties, ensuring that the generated JSON structure conforms to preset rules and avoiding uncontrollable output.
  • Streaming renderingIt supports incremental parsing and streaming rendering. The AI can render the interface in real time while generating JSON, reducing waiting time and improving user experience.
  • Reverse source code generationBased on the generated JSON and Catalog, the built-in compiler can generate standard React source code, making it convenient for developers to further develop or deploy locally.
  • Conditional visibilitySupports dynamically showing or hiding components based on data, permissions, or complex logic, enhancing UI flexibility.
  • Rich motion supportSupports defining actions with confirmation dialogs and callbacks to improve interactivity.
  • Built-in verificationIt supports validation of input fields to ensure the correctness and integrity of data.

How to use json-render

  • Install dependenciesInstall in the project @json-render/core and @json-render/react.
  • Define CatalogCreate a Catalog that explicitly supports the components used by AI, along with their properties and constraints.
  • Registration ComponentDefines a React component used to render components in the Catalog.
  • AI generates JSONBy using a predefined Catalog, AI can generate JSON data that conforms to constraints based on user input.
  • Rendering UI:use json-render The renderer will render the generated JSON data into the actual UI.
  • Local development (optional):clone json-render Use the GitHub repository to run a local development environment and familiarize yourself with its features.
  • Integrate into the project:Will json-render Integrate into actual projects and adjust the Catalog and components as needed.

Project address for json-render

  • GitHub repositoryhttps://github.com/vercel-labs/json-render

Use cases of json-render

  • Data Analysis DashboardBy defining chart and card components in the Catalog, AI generates JSON data based on real-time data and dynamically renders a data analysis dashboard.
  • E-commerce marketing configuration backendDevelopers define components such as carousels and product cards, and AI generates JSON data based on business needs to achieve dynamic configuration of e-commerce marketing pages.
  • Dynamic forms and questionnairesThe Catalog is used to define form components, and AI generates JSON data for the forms based on user needs, enabling the rapid generation of dynamic forms and questionnaires.
  • Exhibition and large-screen visualizationDefine visualization components; AI generates JSON data based on real-time data and dynamically renders it onto the large screen at exhibitions or conferences.