diff --git a/src/main/java/com/citusdata/migration/DynamoDBTableReplicator.java b/src/main/java/com/citusdata/migration/DynamoDBTableReplicator.java index 3629bf4..2e24b08 100644 --- a/src/main/java/com/citusdata/migration/DynamoDBTableReplicator.java +++ b/src/main/java/com/citusdata/migration/DynamoDBTableReplicator.java @@ -580,15 +580,15 @@ public static TableColumnValue columnValueFromDynamoValue(AttributeValue typedVa return new TableColumnValue(TableColumnType.bool, value); } else if (typedValue.getBS() != null) { List value = typedValue.getBS(); - return new TableColumnValue(TableColumnType.jsonb, Jackson.toJsonString(value)); + return new TableColumnValue(TableColumnType.jsonb, cleanupJson(Jackson.toJsonString(value))); } else if (typedValue.getL() != null) { List value = typedValue.getL(); List simpleList = InternalUtils.toSimpleList(value); - return new TableColumnValue(TableColumnType.jsonb, Jackson.toJsonString(simpleList)); + return new TableColumnValue(TableColumnType.jsonb, cleanupJson(Jackson.toJsonString(simpleList))); } else if (typedValue.getM() != null) { - Map value = typedValue.getM(); + Map value = typedValue.getM(); Item simpleMap = Item.fromMap(InternalUtils.toSimpleMapValue(value)); - return new TableColumnValue(TableColumnType.jsonb, simpleMap.toJSON()); + return new TableColumnValue(TableColumnType.jsonb, cleanupJson(simpleMap.toJSON())); } else if (typedValue.getN() != null) { String value = typedValue.getN(); return new TableColumnValue(TableColumnType.numeric, value); @@ -596,16 +596,19 @@ public static TableColumnValue columnValueFromDynamoValue(AttributeValue typedVa List value = typedValue.getNS(); return new TableColumnValue(TableColumnType.jsonb, Jackson.toJsonString(value)); } else if (typedValue.getS() != null) { - String value = typedValue.getS(); - return new TableColumnValue(TableColumnType.text, value); + return new TableColumnValue(TableColumnType.text, cleanupJson(typedValue.getS())); } else if (typedValue.getSS() != null) { List value = typedValue.getSS(); - return new TableColumnValue(TableColumnType.jsonb, Jackson.toJsonString(value)); + return new TableColumnValue(TableColumnType.jsonb, cleanupJson(Jackson.toJsonString(value))); } else { return null; } } + private static String cleanupJson(String value) { + return value.replaceAll("\\\\u0000", "").replaceAll("\u0000", ""); + } + public static TableColumnType columnTypeFromDynamoValue(AttributeValue typedValue) { if(typedValue.getB() != null) { return TableColumnType.bytea;