0

I have exported JSON files from aws dynamodb in this format:

[
  {
    "__typename": "Article",
<snip>
  }
<snip>
]

This results in "Invalid JSON" error:

aws dynamodb batch-write-item --request-items file://Article.json

Error parsing parameter '--request-items': Invalid JSON:

The correct format is (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/SampleData.LoadData.html) How to export the DynamoDB so that I could easily import it to tables? Or is there anything I could do to transform the JSON files that I receive from third party?

0

1 Answer 1

1

The json seems to be invalid. you could use https://jsonlint.com/ to validate the JSON.

A sample valid JSON messages are available at https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/samples/sampledata.zip

To import data to DynamoDB Table

aws dynamodb batch-write-item --request-items file://ProductCatalog.json
{
    "UnprocessedItems": {}
}

you could export data from DynamoDB using the following command

aws dynamodb scan --table-name ProductCatalog > ProductCatalog_export.json

DynamoDB can import data in three formats: CSV, DynamoDB JSON, and Amazon Ion.

  • CSV
  • DynamoDB Json
  • Amazon Ion

More information at https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/S3DataImport.Format.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.