---
title: "JSON Render: UI Components from JSON Specs in Vue Markdown"
description: "Render UI component trees from json-render and yaml-render fenced code blocks in Vue and Vite."
canonical_url: "https://comark.dev/examples/plugins/vue-vite-json-render"
---
# JSON Render: UI Components from JSON Specs in Vue Markdown

> Render UI component trees from json-render and yaml-render fenced code blocks in Vue and Vite.

::code-explorer
```yaml [props]
org: comarkdown
repo: comark@c78885ca7504b38afc7ced59aac1a3c6b3cc5425
path: examples/3.plugins/vue-vite-json-render
defaultValue: src/App.vue
```
::

::browser{src="https://comark-json-render.vercel.app"}
::

This example expands `json-render` and `yaml-render` fenced code blocks into Vue component trees using `@comark/vue/plugins/json-render` and Nuxt UI.

## Features

- **Spec expansion**: parses `json-render` and `yaml-render` fences into Comark element nodes before rendering.
- **Root-and-elements format**: resolves named element maps starting from a `root` key and wires `children` arrays by key.
- **Single-element shorthand**: accepts a single `{ type, props }` object when a full tree map is unnecessary.
- **YAML syntax**: accepts the same component specs written in YAML inside `yaml-render` fences.

## Usage

1. Import the `json-render` plugin:

   ```ts
   import jsonRender from '@comark/vue/plugins/json-render'
   ```
2. Pass the plugin and your target UI components to `<Markdown>`:

   ```vue
   <Markdown
     :value="content"
     :plugins="[jsonRender()]"
     :components="components"
   />
   ```
3. Write `json-render` or `yaml-render` code blocks in Markdown:

   ~~~markdown
   ```json-render
   {
     "type": "Text",
     "props": { "content": "Hello" }
   }
   ```

   ```yaml-render
   type: Text
   props:
     content: Hello
   ```
   ~~~

## Learn more

- [JSON Render plugin documentation](https://comark.dev/plugins/built-in/json-render)
- [JSON Render specification](https://json-render.dev/)


## Sitemap

See the full [sitemap](https://comark.dev/sitemap.md) for all pages.
