---
schema_version: "1"
id: 75d1db24e3df5c74513143bc316aaec43cff4fbf484a7d651fae1ae6fba3df89
title: Serialize Hierarchical Context Data
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/life_sciences_dev_guide/ls_actions_serialize_hierarchical_context_data.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/ls_actions_serialize_hierarchical_context_data.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 11521620acfb963feb9534bf675a9a5bc226bad732f11f214644e3335bf9d292
description: Serializes the hierarchical context data from the Apex embeddedai__RecordApexRepresentation records that are passed as input to a prompt template that generates a summary of the data.
---
# Serialize Hierarchical Context Data

Serializes the hierarchical context data from the Apex embeddedai\_\_RecordApexRepresentation records that are passed as input to a prompt template that generates a summary of the data.

This action is available in API version 62.0 and later.

## Supported REST HTTP Methods

**URI**: /services/data/vXX.X/actions/standard/serializeHierarchicalContextData

Where XX.X is the latest API version.

**Formats**: JSON, XML

**HTTP Methods**: GET

**Authentication**: Authorization: Bearer TOKEN

Where TOKEN is your OAuth access token.

## Inputs

<table class="featureTable sort_table" summary="">



          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d493417e101">Input</th>

              <th class="featureTableHeader  " id="d493417e104">Type</th>

              <th class="featureTableHeader  " id="d493417e107">Description</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d493417e101" data-title="Input"><span class="keyword parmname">recordApexRepresentation</span></td>

              <td class="entry" headers="d493417e104" data-title="Type">Apex type</td>

              <td class="entry" headers="d493417e107" data-title="Description">Required<p class="p">A collection of Apex <samp class="codeph apex_code">embeddedai__RecordApexRepresentation</samp>
                  records that contain the details of the hierarchical
                  data to serialize context data</p>
              </td>

            </tr>

          </tbody>

        </table>

## Outputs

| Output | Type | Description |
| --- | --- | --- |
| serializedContextData | String | A JSON string of serialized hierarchical context data. |

## Example

Sample Request

{
    "inputs": \[
        {
            "recordApexRepresentation": {
                "relatedRecordData": \[
                    {
                        "relatedRecordData": \[
                            {
                                "recordData": \[
                                    {
                                        "value": "Percentage",
                                        "key": "UnitOfMeasureName"
                                    },
                                    {
                                        "value": "Symptom Monitoring",
                                        "key": "IndicatorDefinitionName"
                                    }
                                \],
                                "objectType": "IndicatorAssignment"
                            }
                        \],
                        "recordData": \[
                            {
                                "value": "Reduced Symptoms",
                                "key": "Name"
                            }
                        \],
                        "objectType": "Outcome"
                    }
                \],
                "recordData": \[
                    {
                        "value": "Drug Use Satisfaction Improvement Program",
                        "key": "Name"
                    }
                \],
                "objectType": "CareProgram"
            }
        }
    \]
}

Sample Response

    {
        "serializedContextData": {
            "CareProgram": {
                "Name": "Drug Use Satisfaction Improvement Program",
                "Outcome": \[
                    {
                        "Name": "Reduced Symptoms",
                        "IndicatorAssignment": \[
                            {
                                "IndicatorDefinitionName": "Symptom Monitoring",
                                "UnitOfMeasureName": "Percentage"
                            }
                        \]
                    }
                \]
            }
        }
    }