---
title: "JSON to HTML"
description: "Developer documentation for Topol's embeddable white-label email editor and landing page editor (beta). Get practical insights and guidance for integration and optimized user experiences."
url: https://docs.topol.io/email-editor/guide/operations/convertJson2Html.html
---

## JSON to HTML

Convert JSON template to HTML using MJML rendering engine. Authentication is done via the X-Secret-Key header.

If the template contains synced sections (any section node with a `syncedId` property), the matching content must be supplied through the optional `syncedSections` request field. Synced section references are resolved before merge tag evaluation and variant rendering: the endpoint looks up each `syncedId` in the supplied array, splices the section's full MJML into the template, regenerates child block UIDs to avoid collisions, and (for multilingual templates) merges per-locale translations into the template's `langs` array. Without this step, synced sections render as empty placeholders.

### Endpoint

`POST https://api.topol.io/email/v1/json2html`

### Authentication

- **SecretKeyAuth** (header `X-Secret-Key`) — Secret key for authentication

### Request body (required)

Template conversion request

Content-Type: `application/json`

- `definition` _string_ **required** — JSON template definition
- `options` _object_ **required**
  - `minify` _boolean_ — Whether to minify the output HTML
  - `fonts` _string_ — JSON string containing an array of font objects with label, style, and url properties
  - `emailServiceProvider` _"mailchimp" | "sparkpost"_ — Target email service provider
  - `mergeTags` _any[]_ — Array of merge tags for template variable substitution
  - `evaluateMergeTags` _boolean_ — Whether to evaluate merge tags in the template
  - `variants` _object_
    - `evaluate` _boolean_ — Whether to evaluate variants
    - `enrichWithConditions` _boolean_ — Whether to enrich with conditional logic
  - `desktopFirst` _boolean_ — Whether to prioritize desktop layout
  - `language` _string_ — Template language code
- `syncedSections` _object[]_ — Resolved content for every synced section referenced by the template. A section in the template JSON that carries a `syncedId` is stored as a lightweight reference only; the rendering pipeline must be supplied with the matching content here, otherwise the section renders empty. Fetch each referenced synced section from your saved-sections storage (see the Saved Blocks and Synced Sections guide) and pass it in this array before calling this endpoint.
  - `id` _number_ **required** — ID of the synced section. Must match the `syncedId` on a section node in the template JSON.
  - `definition` _string_ **required** — JSON-encoded MJML definition of the synced section (string, not a nested object).
  - `translation` _string_ — Optional JSON-encoded locale-keyed translation map for multilingual templates. Required if the template has language mutations and the section contains translatable content.

### Responses

#### 200 — Template converted successfully

Content-Type: `application/json`

- `html` _string_ **required** — Rendered HTML output
- `warnings` _object[]_ — Optional warnings about the conversion
  - `type` _"missing_fonts"_ **required** — Type of warning
  - `message` _string_ **required** — Warning message
  - `missing_fonts` _string[]_ — List of missing font names

#### 400 — Bad request - missing or invalid request body

Content-Type: `application/json`

- `message` _string_ **required** — Error message

#### 401 — Unauthorized - invalid or expired API key

Content-Type: `application/json`

- `message` _string_ **required** — Error message

#### 422 — Validation error - invalid request format

Content-Type: `application/json`

- `message` _string_ **required** — Main error message
- `errors` _object[]_ **required** — List of validation errors
  - `field` _string_ — Field that failed validation
  - `message` _string_ — Specific validation error message

#### 500 — Internal server error

Content-Type: `application/json`

- `message` _string_ **required** — Error message
