---
schema_version: "1"
id: d54832e4506caecb0a890cc612f1a10aaf37c198b7ba06fb3e1aef405c2171d0
title: ApexMap Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/life_sciences_dev_guide/apex_class_embeddedai_ApexMap.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_ApexMap.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: fe9dca55feeb2fd6500c9355b537f1ab98e4d02b919a37b025dcc4c5665a4da4
description: Create, clone, and convert string based key-value pairs to a JSON string format.Learn more about the constructors available with the ApexMap class.Initializes a new instance of the ApexMap class by assigning the specified key and value. This constructor creates a single key–value entry that can be included in an embedded AI Apex map for passing contextual data to embedded AI logic.Initializes the ApexMap class.Represents key of the key-value pair. This property is used to store the unique ID or name of the data.Represents value of the key-value pair. This property is used to store the data associated with the key.Create a copy of the ApexMap object and convert key-value pairs to string format.Returns a string representation of the ApexMap object.
---
# ApexMap Class

Create, clone, and convert string based key-value pairs to a JSON string format.

## Namespace

[embeddedai](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_namespace_embeddedai.htm "The embeddedai namespace provides classes and methods to manage and represent records and data in Apex to support embedded AI features.")

- **[ApexMap Constructors](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_ApexMap.htm#apex_embeddedai_ApexMap_constructors)**  
    Learn more about the constructors available with the ApexMap class.
- **[ApexMap Properties](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_ApexMap.htm#apex_embeddedai_ApexMap_properties)**
- **[ApexMap Methods](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_ApexMap.htm#apex_embeddedai_ApexMap_methods)**  
    Create a copy of the ApexMap object and convert key-value pairs to string format.

## ApexMap Constructors

Learn more about the constructors available with the ApexMap class.

The ApexMap class includes these constructors.

- **[ApexMap(key, value)](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_ApexMap.htm#apex_embeddedai_ApexMap_ctor)**  
    Initializes a new instance of the ApexMap class by assigning the specified key and value. This constructor creates a single key–value entry that can be included in an embedded AI Apex map for passing contextual data to embedded AI logic.
- **[ApexMap()](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_ApexMap.htm#apex_embeddedai_ApexMap_ctor_2)**  
    Initializes the ApexMap class.

### ApexMap(key, value)

Initializes a new instance of the ApexMap class by assigning the specified key and value. This constructor creates a single key–value entry that can be included in an embedded AI Apex map for passing contextual data to embedded AI logic.

#### Signature

public ApexMap(String key, String value)

#### Parameters

- **key**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexref.meta/apexref/apex_methods_system_string.htm)
    
    The unique identifier for an entry in the embedded AI Apex map. This key references and retrieves the associated value during embedded AI processing.
- **value**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexref.meta/apexref/apex_methods_system_string.htm)
    
    The data associated with the specified key in the embedded AI Apex map. This value stores the contextual information consumed by embedded AI logic.

### ApexMap()

Initializes the ApexMap class.

#### Signature

public ApexMap()

## ApexMap Properties

These are the properties for ApexMap.

- **[key](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_ApexMap.htm#apex_embeddedai_ApexMap_key)**  
    Represents key of the key-value pair. This property is used to store the unique ID or name of the data.
- **[value](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_ApexMap.htm#apex_embeddedai_ApexMap_value)**  
    Represents value of the key-value pair. This property is used to store the data associated with the key.

### key

Represents key of the key-value pair. This property is used to store the unique ID or name of the data.

#### Signature

public String key {get; set;}

#### Property Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexref.meta/apexref/apex_methods_system_string.htm)

### value

Represents value of the key-value pair. This property is used to store the data associated with the key.

#### Signature

public String value {get; set;}

#### Property Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexref.meta/apexref/apex_methods_system_string.htm)

## ApexMap Methods

Create a copy of the ApexMap object and convert key-value pairs to string format.

These are the methods for ApexMap.

- **[toString()](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/apex_class_embeddedai_ApexMap.htm#apex_embeddedai_ApexMap_toString)**  
    Returns a string representation of the ApexMap object.

### toString()

Returns a string representation of the ApexMap object.

#### Signature

public String toString()

#### Return Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexref.meta/apexref/apex_methods_system_string.htm)