Unmarshal will unmarshal DynamoDB AttributeValues to Go value types. Both generic interface{} and concrete types are valid unmarshal destination types.

Unmarshal will allocate maps, slices, and pointers as needed to unmarshal the AttributeValue into the provided type value.

When unmarshaling AttributeValues into structs Unmarshal matches the field names of the struct to the AttributeValue Map keys. Initially it will look for exact field name matching, but will fall back to case insensitive if not exact match is found.

With the exception of omitempty, omitemptyelem, binaryset, numberset and stringset all struct tags used by Marshal are also used by Unmarshal.

When decoding AttributeValues to interfaces Unmarshal will use the following types.

[]byte,                 AV Binary (B)
[][]byte,               AV Binary Set (BS)
bool,                   AV Boolean (BOOL)
[]interface{},          AV List (L)
map[string]interface{}, AV Map (M)
float64,                AV Number (N)
Number,                 AV Number (N) with UseNumber set
[]float64,              AV Number Set (NS)
[]Number,               AV Number Set (NS) with UseNumber set
string,                 AV String (S)
[]string,               AV String Set (SS)

If the Decoder option, UseNumber is set numbers will be unmarshaled as Number values instead of float64. Use this to maintain the original string formating of the number as it was represented in the AttributeValue. In addition provides additional opportunities to parse the number string based on individual use cases.

When unmarshaling any error that occurs will halt the unmarshal and return the error.

The output value provided must be a non-nil pointer