dynobase-icon
Dynobase

DynamoDB: Query JSON (Guide w/ Code Examples)

Rafal Wilinski

Provided by Rafal Wilinski

JavaScript AWS SDK does not provide a specific method to query data as JSON. But you can use the query operation to get data as an array and pass the result to JSON.stringify method to convert the array to a JSON string.

const AWS = require('aws-sdk'); const dynamoDb = new AWS.DynamoDB.DocumentClient(); const params = { TableName: 'tableName', KeyConditionExpression: 'primaryKey = :primaryKeyValue', ExpressionAttributeValues: { ':primaryKeyValue': 'value' } }; dynamoDb.query(params, (error, data) => { if (error) { console.error(error); return; } console.log(JSON.stringify(data.Items)); });

Spend less time in the AWS console, use Dynobase.

First 7 days are. No credit card needed.

Product Features

Download
/
Changelog
/
Pricing
/
Member Portal
/
Privacy
/
EULA
/
Twitter
© 2024 Dynobase
+
Using DynamoDB Console frequently?
Try Dynobase to accelerate your DynamoDB workflow. Start your 7-day free trial today.