The answers to the question Converting DynamoDB JSON to Standard JSON with Java are obsolete in 2022.
The problem is that both of these imports no longer work:
import com.amazonaws.services.dynamodbv2.document.internal.InternalUtils;
import com.amazonaws.services.dynamodbv2.document.ItemUtils;
What happens: the import fails.
You can also verify it in the documentation, here: https://sdk.amazonaws.com/java/api/latest/index.html?software/amazon/awssdk/services/dynamodb/package-summary.html
The question is, what classes replace these two classes in SDK 2.x?
Per the comments above, there is currently no solution via the AWS SDK V2.
The following code works to convert values to usable JSON when working directly with the DynamoDB API:
The resulting
Map<String, Object>
can then be fed to Jackson for further processing like normal json data.Another Use-Case
The following works for converting DynamoDB JSON after it's already been parsed via Jackson without going through the DynamoDB API, for example during Unit Testing with a JSON file retrieved from logs or an S3 export: