diff --git a/dynamodump/dynamodump.py b/dynamodump/dynamodump.py index bcb2f798..5a03ef35 100755 --- a/dynamodump/dynamodump.py +++ b/dynamodump/dynamodump.py @@ -64,12 +64,20 @@ def encoder(self, obj): json.JSONEncoder.default = encoder +def process_list_type(list): + for elem in list: + if "B" in elem: + elem["B"] = base64.b64decode(elem["B"].encode("utf-8")) + + def process_item_types(dct): for item in dct["Items"]: for key in item: val = item[key] if "B" in val: item[key]["B"] = base64.b64decode(val["B"].encode("utf-8")) + elif "L" in val: + process_list_type(val["L"]) def _get_aws_client( diff --git a/tests/testTable/data/0001.json b/tests/testTable/data/0001.json index 75cf5155..cd85e54a 100644 --- a/tests/testTable/data/0001.json +++ b/tests/testTable/data/0001.json @@ -10,6 +10,13 @@ }, "firstName": { "S": "John" + }, + "list": { + "L": [ + { + "B": "1234" + } + ] } } ], diff --git a/tests/testTable/schema.json b/tests/testTable/schema.json index 4c01257b..1eb9c696 100644 --- a/tests/testTable/schema.json +++ b/tests/testTable/schema.json @@ -15,7 +15,7 @@ "ReadCapacityUnits": 1, "LastDecreaseDateTime": 0.0 }, - "TableSizeBytes": 28, + "TableSizeBytes": 39, "TableName": "testTable", "TableStatus": "ACTIVE", "KeySchema": [