# Testing your Email with Template Data


Use the Data tab in the Dyspatch Email Builder to power <glossary-term word="dynamic email content"></glossary-term> in your email previews.

Template Data can be built using the data builder or added as a JSON object, similar to what your system might use when passing data to an email for rendering.

<div class="highlight note">Template Data is similar to <a href="/emails/using_customer_profiles">Customer Profiles</a>, each is data your team enters into Dyspatch to preview dynamic content. Template Data is unique to the template it is stored in, whereas Customer Profiles are available in all workspaces they're assigned to.</div>

## Building Template Data Using the Data Builder

Use the Data Builder in the **Data** > **Preview Data** tab in the Email Builder to create dynamic test data for that specific email.

![Example of adding template data in the data builder](https://docs.dyspatch.io/img/emails/data-builder.png "class: idm img-size-75")

Add the name of your variable and a value in the placeholder field. Any data type that is supported in JSON can be used in the Data Builder. This includes: strings, integers, booleans, arrays, and objects.

## Building Template Data Using JSON

To add or edit Template Data in JSON format, select the **Code editor** view option in the Template Data tab. See more on how to use JSON data below.

![Example of adding template data as json in the json data builder](https://docs.dyspatch.io/img/emails/json-data-builder.png "class: img-size-75")

## What is JSON?

JSON is a format for representing data with key and value pairs, used to store and exchange data. A JSON key has to be text wrapped in double quotes, e.g. "firstName". A JSON value can be text, numbers, lists, etc.

### An Example JSON Object

Below is an example of a JSON object, with some values: a string `"Kieran"`, a boolean `true`, a number `6`, a list of strings `["sushi", "pizza", "hash browns"]`, and a string inside of a nested object `"food and drink"`.

```json
{
  "firstName": "Kieran",
  "isPaidUser": true,
  "daysSinceLastLogin": 6,
  "favFoods": ["sushi", "pizza", "hash browns"],
  "userMetadata": {
    "likes": [
      "food and drink"
    ]
  }
}
```

### Template Data Errors

Incorrect formatting of template data will cause a warning to appear in your Preview Pane with a description of the error and an x on the line with the error. The error in the example below is because JSON keys and values need a colon " : " between them on line 2.

![Template data error](https://docs.dyspatch.io/img/emails/preview-data-error.png)

### Where is Template Data Used?

Template data is used in the Dyspatch Editor Preview Pane, for [Device Previews](/emails/testing_with_device_previews/), and for [test sending](/emails/sharing_emails_in_dyspatch/#send-test-email).

<div class="highlight note">
Dynamic Data values are only for previewing variable content in Dyspatch, their values will not be used in your live emails
</div>

## Enabling and Disabling Template Data

Toggle **Template** data on or off in the Preview Data tab to control whether this email's Template Data is applied to your preview. This works alongside **Global** and **Customer Profiles**.

<div class="highlight note">Toggling off all Dynamic Data types will turn off conditional preview rendering and show all conditional blocks</div>

## Using Template Data in Emails
Once you have configured your template data, you can now reference these data points in your email. In a particular field, type the `@` symbol to bring up a list of your predefined varaibles.

<img class="img-status img-border" src="https://docs.dyspatch.io/img/emails/preview-data-email-builder.gif" alt="Template data in email builder dropdown selector"/>

<div class="highlight tip">Variables from a selected Customer Profile and from Global data also show in the input variable autocomplete</div>

### Combining Dynamic Data Types

Template Data, [Global Variables](/emails/using_customer_profiles/#using-global-variables), and [Customer Profiles](/emails/using_customer_profiles/) can all be active at the same time. When more than one source is enabled, their data is merged — with Customer Profile values taking priority over Template and Global data when the same key appears in multiple sources.

Each source can be toggled independently in the **Data** tab, giving you fine-grained control over what data is applied to your preview at any time.

<div class="highlight note">Turning off both <b>Template</b> and <b>Global</b> data, with no Customer Profile selected, also turns off conditional block rendering — every block in your preview will show regardless of its display logic. Turning any of the three back on re-enables conditional block rendering, indicated by a green dot next to the Data tab.</div>

See [Enabling and Disabling Dynamic Data Previews](/emails/using_customer_profiles/#enabling-and-disabling-dynamic-data-previews) for more detail on how the three sources combine.

## Next Step: Creating Personalized Emails

By adding robust data to your Template Data, you can use personalization and [conditional content](/emails/using_conditionals/) to tailor your customer's emails and feel good about personalizing emails with more dynamic content.
