# DynamoAttributeValue

Represents the data for an attribute.

Each attribute value is described as a name-value pair.
The name is the data type, and the value is the data itself.

- Source: [`aws-stepfunctions-tasks/lib/dynamodb/shared-types.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/dynamodb/shared-types.ts#L121)
- Type last changed: v2.178.0 · 6 Feb 2025

## Example

```ts
declare const myTable: dynamodb.Table;
new tasks.DynamoDeleteItem(this, 'DeleteItem', {
  key: { MessageId: tasks.DynamoAttributeValue.fromString('message-007') },
  table: myTable,
  resultPath: sfn.JsonPath.DISCARD,
});
```

## Properties

- `attributeValue`: any — Represents the data for the attribute.

  Data can be
  i.e. "S": "Hello"

## Methods

- `booleanFromJsonata(value: string): DynamoAttributeValue // chainable` (static) — Sets an attribute of type Boolean from state input through JSONata expression.

  For example:  "BOOL": true

  **Parameters**

  - `value` — JSONata expression that specifies state input to be used.

- `booleanFromJsonPath(value: string): DynamoAttributeValue // chainable` (static) — Sets an attribute of type Boolean from state input through Json path.

  For example:  "BOOL": true

  **Parameters**

  - `value` — Json path that specifies state input to be used.

- `fromBinary(value: string): DynamoAttributeValue // chainable` (static) — Sets an attribute of type Binary.

  For example:  "B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"

  **Parameters**

  - `value` — base-64 encoded string.

- `fromBinarySet(value: string[]): DynamoAttributeValue // chainable` (static) — Sets an attribute of type Binary Set.

  For example:  "BS": ["U3Vubnk=", "UmFpbnk=", "U25vd3k="]

- `fromBoolean(value: boolean): DynamoAttributeValue // chainable` (static) — Sets an attribute of type Boolean.

  For example:  "BOOL": true

- `fromList(value: DynamoAttributeValue[]): DynamoAttributeValue // chainable` (static) — Sets an attribute of type List.

  For example:  "L": [ {"S": "Cookies"} , {"S": "Coffee"}, {"N", "3.14159"}]

- `fromMap(value: { [key: string]: DynamoAttributeValue }): DynamoAttributeValue // chainable` (static) — Sets an attribute of type Map.

  For example:  "M": {"Name": {"S": "Joe"}, "Age": {"N": "35"}}

- `fromNull(value: boolean): DynamoAttributeValue // chainable` (static) — Sets an attribute of type Null.

  For example:  "NULL": true

- `fromNumber(value: number): DynamoAttributeValue // chainable` (static) — Sets a literal number.

  For example: 1234
  Numbers are sent across the network to DynamoDB as strings,
  to maximize compatibility across languages and libraries.
  However, DynamoDB treats them as number type attributes for mathematical operations.

- `fromNumberSet(value: number[]): DynamoAttributeValue // chainable` (static) — Sets an attribute of type Number Set.

  For example:  "NS": ["42.2", "-19", "7.5", "3.14"]
  Numbers are sent across the network to DynamoDB as strings,
  to maximize compatibility across languages and libraries.
  However, DynamoDB treats them as number type attributes for mathematical operations.

- `fromString(value: string): DynamoAttributeValue // chainable` (static) — Sets an attribute of type String.

  For example:  "S": "Hello"
  Strings may be literal values or as JSONata expression or as JsonPath. Example values:

  - `DynamoAttributeValue.fromString('someValue')`
  - `DynamoAttributeValue.fromString('{% $bar %}')`
  - `DynamoAttributeValue.fromString(JsonPath.stringAt('$.bar'))`

- `fromStringSet(value: string[]): DynamoAttributeValue // chainable` (static) — Sets an attribute of type String Set. For example: "SS": ["Giraffe", "Hippo" ,"Zebra"].

  This method only accepts static arrays defined at CDK synthesis time.
  Dynamic value resolution via JSONata or JsonPath is not supported for Set types.

- `listFromJsonata(value: string): DynamoAttributeValue // chainable` (static) — Sets an attribute of type List.

  For example:  "L": [ {"S": "Cookies"} , {"S": "Coffee"}, {"S", "Veggies"}]

  **Parameters**

  - `value` — JSONata expression that specifies state input to be used.

- `listFromJsonPath(value: string): DynamoAttributeValue // chainable` (static) — Sets an attribute of type List.

  For example:  "L": [ {"S": "Cookies"} , {"S": "Coffee"}, {"S", "Veggies"}]

  **Parameters**

  - `value` — Json path that specifies state input to be used.

- `mapFromJsonata(value: string): DynamoAttributeValue // chainable` (static) — Sets an attribute of type Map.

  For example:  "M": {"Name": {"S": "Joe"}, "Age": {"N": "35"}}

  **Parameters**

  - `value` — JSONata expression that specifies state input to be used.

- `mapFromJsonPath(value: string): DynamoAttributeValue // chainable` (static) — Sets an attribute of type Map.

  For example:  "M": {"Name": {"S": "Joe"}, "Age": {"N": "35"}}

  **Parameters**

  - `value` — Json path that specifies state input to be used.

- `numberFromString(value: string): DynamoAttributeValue // chainable` (static) — Sets an attribute of type Number.

  For example:  "N": "123.45"
  Numbers are sent across the network to DynamoDB as strings,
  to maximize compatibility across languages and libraries.
  However, DynamoDB treats them as number type attributes for mathematical operations.

  Numbers may be expressed as literal strings or as JSONata expression or as JsonPath

- `numberSetFromStrings(value: string[]): DynamoAttributeValue // chainable` (static) — Sets an attribute of type Number Set.

  For example:  "NS": ["42.2", "-19", "7.5", "3.14"]
  Numbers are sent across the network to DynamoDB as strings,
  to maximize compatibility across languages and libraries.
  However, DynamoDB treats them as number type attributes for mathematical operations.

  Numbers may be expressed as literal strings or as JsonPath

- `toObject(): any` — Returns the DynamoDB attribute value.
