What does DynamoDB two way converter do?
The DynamoDB two-way converter is an online tool that facilitates the transformation of a JSON structure into a format compatible with Amazon DynamoDB database. This converter is capable of handling rows in DynamoDB with various permissible structures, including those with multiple nested levels.
Available for use without any charge, it is an invaluable resource for anyone seeking a quick and efficient means to convert data formats suitable for DynamoDB. This includes applications in learning, using the AWS Command Line Interface (CLI), or inputting data into the AWS console's graphical user interface.
Additionally, the tool offers the functionality to convert data from DynamoDB's format back into standard JSON, if required.
Adding a new item to DynamoDB from a local file containing data in DynamoDB formatted JSON with AWS CLI.
aws dynamodb batch-write-item --request-items file://path/to/yourfile.json
What format does DynamoDB use for data representation?
DynamoDB uses a specific JSON format that is distinct from standard JSON to represent its data types. This format is often referred to as DynamoDB JSON.
The key difference is how DynamoDB JSON represents data types. Each value in DynamoDB JSON is a key-value pair where the key is a single-letter code that represents the type of the value, and the value is the actual data value.
Overview of the data type representations in DynamoDB JSON:
String (S): Represents a string data type.
{ "S": "Example string" }
Number (N): Represents a number. Numbers are represented as strings to preserve precision.
{ "N": "123.45" }
Null (NULL): Represents a null value.
{ "NULL": true }
Boolean (BOOL): Represents a boolean value (true or false).
{ "BOOL": true }
Binary (B): Represents binary data as a base64-encoded string.
{ "B": "base64EncodedString" }
List (L): Represents an ordered collection of values.
{ "L": [{"S": "a"}, {"N": "1"}] }
Map (M): Represents a collection of key-value pairs.
{
"M": {
"key1": { "S": "value1" },
"key2": { "N": "123" }
}
}
String Set (SS): Represents a set of unique strings.
{ "SS": ["a", "b"] }
Number Set (NS): Represents a set of unique numbers.
{ "NS": ["1", "2"] }
Binary Set (BS): Represents a set of unique binary values.
{ "BS": ["base64S1", "base64S2"] }
References