DynamoDB: Query JSON (Guide w/ Code Examples)

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)); });
Similar Code Examples
- DynamoDB: Delete Multiple Items in Javascript
- DynamoDB: Query Date Range
- DynamoDB: Get By ID
- DynamoDB: Query Global Secondary Index in Nodejs
- DynamoDB: Batch Get
- DynamoDB: Attribute Not Null
- DynamoDB: GetItem
- DynamoDB: Get Multiple Items
- DynamoDB: Get Last 10 Records
- DynamoDB: Increment Counter
- DynamoDB Get in Typescript
- DynamoDB: Query Items
- DynamoDB: Not Begins With
- DynamoDB: Query Count
- DynamoDB BatchWriteItem in Typescript
Dynobase is a Professional GUI Client for DynamoDB
Start your 7-day free trial today
Product Features
DynamoDB Tools
DynamoDB Info
© 2026 Dynobase