Skip to content

Preserve JSON helper methods in the DynamoDB Document API #1862

@gibbonsj

Description

@gibbonsj

Provide DDB Document API method parity by including toJSON() and fromJSON() methods.

See #36 comments from @millems suggesting a new feature request be opened.

This capability was a welcomed addition to the V1 Document API because it was a convenient and low-friction way to work with JSON document strings and DDB.

Adding a notional V1 to V2 DDB Document API migration example that uses both methods.

-- From v1 --

AmazonDynamoDB dynamoDB = AmazonDynamoDBClientBuilder
...
DynamoDB dynamo = new DynamoDB(dynamoDB);
dbtable = dynamo.getTable(table);

dbtable.putItem(Item.fromJSON(jsonString));
Item item = dbtable.getItem(spec);
String jsonString = item.toJSON();

-- To v2 --

DynamoDbClient ddbClient = DynamoDbClient
.builder()
...
.build();

??? ddbClient.putItem(Item.fromJSON(jsonString))
??? jsonString = ddbClient.getItem(spec).toJSON()

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestA feature should be added or improved.p1This is a high priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions