---
schema_version: "1"
id: 3241b14eb96beb2ef0631f0047deee2c1fbefb4185a8dcb5d0061195baaabb4f
title: Access Omniscript Data JSON with Merge Fields
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/os_access_omniscript_data_json_with_merge_fields_22053.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.os_access_omniscript_data_json_with_merge_fields_22053.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: bf432f2e858cd5541800949af27bba01e117b64357d9f5d86e01d537c5de1000
description: 'Enable Omniscript elements and element properties to access data JSON using merge fields. A merge field is a variable that references the value of a JSON node. For example, if a JSON node is "FirstName": "John", then the merge field %FirstName% returns John.'
products:
  - Omnistudio
release: "264"
---
# Access Omniscript Data JSON with Merge Fields

Enable Omniscript elements and element properties to access data JSON using merge fields. A merge field is a variable that references the value of a JSON node. For example, if a JSON node is `"FirstName": "John"`, then the merge field `%FirstName%` returns `John`.

Merge fields access data JSON using syntax to indicate to an Omniscript Element that a merge field is present. The syntax requires you to wrap a full JSON path with a percent sign on both ends.

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/images/icon_note.png)

Note

Only certain element properties support merge fields.

Text between two percent (%) signs in a Set Values formula or text field is treated as a merge field. To represent literal percent (%) signs, use the `$Vlocity.Percent` [environment variable](https://help.salesforce.com/s/articleView?id=xcloud.os_environment_variables_in_dataraptors_and_integration_procedures_47878.htm&release=264.0.0&type=5 "You can use environment variables to define Default Values and Filter Values, and in Formulas.").

## Common Use Cases for Accessing JSON with Merge Fields

Learn about common use cases for accessing Omniscript data JSON with merge fields.

- Setting Values to rename elements, access JSON nodes, run formulas, and populate elements. For more information, see [Set Values in an Omniscript](https://help.salesforce.com/s/articleView?id=xcloud.os_set_values_in_an_omniscript_22132.htm&release=264.0.0&type=5 "Use the Set Values action to set element values in subsequent steps, rename JSON nodes, create dynamic values, and concatenate data. Set Values actions use merge fields to access JSON data in other Omniscript elements.")
- Access data stored in Omniscript elements in a formula or in a future step.
- Access data returned from an Action. For example, an HTTP Action or Omnistudio Data Mapper Action returns data from Salesforce or an external source. For more information on Actions, see [Omniscript Action Elements](https://help.salesforce.com/s/articleView?id=xcloud.os_omniscript_action_elements_10951.htm&release=264.0.0&type=5 "Use action elements in an Omniscript for executing actions, such as get or update data from one or more Salesforce objects, call a series of actions, send emails or documents for signature, redirect to different pages. Action elements can be either rendered as a button when placed in a Step or Block or run remotely if placed between steps. In either case, you can specify a redirect page, where the user can proceed to the next step or action, or if a button, back to the source step.").
- Access data passed in as a parameter from a page.

## Access the Data JSON

Use existing data JSON in an element property by indicating the use of a merge field.

1. Locate the name of the JSON node in the Omniscript's data JSON.
    
    ![Example of a JSON node named firstName with a value of John](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/omnistudio/images/omniscript_merge_data_json.png)
2. Enter the name of the JSON node and wrap the name in percentage signs to indicate it is a merge field.
    
    For example, a merge field accessing a JSON node named firstName must use the syntax %firstName%.
    
    ![Merge field that refers to the firstName JSON node](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/omnistudio/images/omniscript_merge_syntax.png)
3. Preview the Omniscript to ensure the Merge field works correctly.
    
    ![Preview of the Omniscript that shows "Welcome, John!"](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio-264-0-0-production-enus/f526eaa8-ae05-487a-8944-4bb99b0b78ac/omnistudio/images/omniscript_merge_field_result.png)

## Additional Syntax

Check out additional syntax examples for nested JSON.

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col>
              <col>
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d30460e219">JSON Node</th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d30460e222">Merge Field Syntax Example</th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="JSON Node" class="slds-cell-wrap" style="vertical-align:top;" headers="d30460e219 ">
                  <pre class="line-numbers slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium slds-scrollable_x"><code>"ContactInfo": {
    "FirstName": "John"
  }</code></pre>
                </td>

                <td data-label="Merge Field Syntax Example" class="slds-cell-wrap" style="vertical-align:top;" headers="d30460e222 ">
                  <p>Use a colon symbol <code>:</code> to access a nested JSON
                    node.</p>
                  <pre class="line-numbers slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium slds-scrollable_x"><code>%ContactInfo:FirstName%</code></pre>
                </td>

              </tr>
              <tr class="">
                <td data-label="JSON Node" class="slds-cell-wrap" style="vertical-align:top;" headers="d30460e219 ">
                  <pre class="line-numbers slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium slds-scrollable_x"><code>"ParentObject": {
    "NumberMap": [
      1,
      2,
      3
    ]
  }</code></pre>
                </td>

                <td data-label="Merge Field Syntax Example" class="slds-cell-wrap" style="vertical-align:top;" headers="d30460e222 ">
                  <p>Use a colon symbol <code>:</code> to access nested JSON nodes
                    and a pipe symbol <code>|</code> to access the index of the array
                    that value.</p>
                  <pre class="line-numbers slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium slds-scrollable_x"><code>%ParentObject:NumberMap|3%</code></pre>
                </td>

              </tr>
              <tr class="">
                <td data-label="JSON Node" class="slds-cell-wrap" style="vertical-align:top;" headers="d30460e219 ">
                  <pre class="line-numbers slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium slds-scrollable_x"><code> "ContactInfoStep": {
    "ContactInfoBlock": [
      {
        "FirstName": "John"
      },
      {
        "FirstName": "Adam"
      },
      {
        "FirstName": "Steve"
      }
    ]
  }</code></pre>
                </td>

                <td data-label="Merge Field Syntax Example" class="slds-cell-wrap" style="vertical-align:top;" headers="d30460e222 ">
                  <p>When a formula exists within a repeatable block, use <code>|n</code> to access the node in which the formula exists. Depending upon which node the
                    formula exists in, it will return the correlating value. For more information, see <a href="https://help.salesforce.com/s/articleView?id=xcloud.os_evaluating_elements_in_repeatable_blocks_21869.htm&amp;release=264.0.0&amp;type=5" title="Suppose you place an element in a repeatable block (a Block or an Edit Block) and you want to access data that is calculated in a different element. The method that you use to access the data depends on whether the element containing the data is within or outside the same repeatable block in the Omniscript. Review guidelines and examples for the Formula element and for the Select element, which is used to add a dependent picklist to an Omniscript.">Access to Data Within and Outside a Repeatable Block</a>.</p>
                  <pre class="line-numbers slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium slds-scrollable_x"><code>%ContactInfoStep:ContactInfoBlock|n:FirstName%</code></pre>
                </td>

              </tr>
            </tbody>
          </table>