What does the DynamoDB JSON to Standard JSON Converter do?
The DynamoDB JSON to Standard JSON Converter & Unmarshaller transforms verbose AWS DynamoDB typed attribute JSON payloads (such as {"S": "user#12"} or {"N": "34"}) into clean, standard JSON objects and arrays. It strips out low-level DynamoDB type descriptors recursively across maps, lists, string sets, and binary values.
Core Concepts
Understanding DynamoDB typed attribute descriptors:
- Attribute Value Wrappers: In DynamoDB APIs, primitive types are wrapped in descriptor keys:
"S"(String),"N"(Number),"BOOL"(Boolean),"NULL"(Null),"M"(Map),"L"(List),"SS"(String Set),"NS"(Number Set), and"BS"(Binary Set). - Recursive Unmarshalling: Traverses deeply nested maps and array collections to restore original object models without loss of precision.
- Batch Processing: Supports unmarshalling individual database items or multi-item array results returned from AWS CLI
aws dynamodb scanandqueryoperations.
How to use the tool?
- Paste DynamoDB JSON: Paste your raw DynamoDB typed JSON payload or batch array into the editor or click Load Sample.
- Execute Conversion: Click Convert to Standard JSON to recursively unmarshall all typed attribute descriptors.
- Copy & Export: Click Copy or Download to save your clean standard JSON document.
Related Developer Utilities
If you work with AWS DynamoDB, cloud infrastructure, and JSON formatting, explore these complementary tools:
- Standard JSON to DynamoDB JSON Converter: Convert standard JSON objects into DynamoDB typed attribute format.
- AWS IAM Policy Minifier: Compress IAM policies and resolve 6,144 character quota errors.
- JSON Formatter & Beautifier: Format and prettify messy JSON payloads.
- JSON Syntax Validator: Validate JSON syntax and inspect character offsets.
REST API Integration
Blueutils provides a free REST API endpoint (POST https://blueutils.com/api/aws/dynamodb-to-json) to programmatically convert verbose DynamoDB JSON structures into standard clean JSON payloads.
API Request Parameters
| Name | Type | Description | Example |
|---|---|---|---|
rawText |
String | Input JSON string containing DynamoDB attribute types to unmarshall. | "{\"pk\":{\"S\":\"user#102\"}}" |
API Request Payload Examples
cURL
curl -X POST https://blueutils.com/api/aws/dynamodb-to-json \
-H "Content-Type: application/json" \
-d '{
"rawText": "{\"pk\": {\"S\": \"user#102\"}, \"age\": {\"N\": \"34\"}}"
}'Python
import requests
url = "https://blueutils.com/api/aws/dynamodb-to-json"
payload = { "rawText": '{"pk": {"S": "user#102"}, "age": {"N": "34"}}' }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String jsonPayload = """
{
"rawText": "{\\"pk\\": {\\"S\\": \\"user#102\\"}, \\"age\\": {\\"N\\": \\"34\\"}}"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://blueutils.com/api/aws/dynamodb-to-json"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}API Response Parameters
| Name | Type | Description | Example |
|---|---|---|---|
isValid |
Boolean | Indicates whether conversion succeeded. | true |
outputText |
String | Formatted standard clean JSON string. | "{\n \"pk\": \"user#102\"\n}" |
API Response Payload Examples
Success Response (HTTP 200 OK)
{
"isValid": true,
"outputText": "{\n \"pk\": \"user#102\",\n \"age\": 34\n}"
}Validation Failure Response (HTTP 400 Bad Request)
{
"isValid": false,
"error": "Invalid JSON syntax: Unexpected token in JSON at position 5"
}Rate Limit Exceeded Response (HTTP 429 Too Many Requests)
{
"error": "API rate limit exceeded. Please wait or contact support@blueutils.com."
}Why use an API to convert DynamoDB JSON?
Integrating the DynamoDB JSON to Standard JSON API into data pipelines, ETL workflows, or serverless microservices provides essential benefits:
- Rapid Script Validation: Converts raw AWS DynamoDB scan and query results into standard clean JSON structures before sending to downstream services.
- Optimized Token Efficiency for AI Agents: LLMs consume unnecessary tokens parsing verbose
{"S": "..."}type wrappers. Unmarshalling payloads via API strips 40% to 60% of redundant formatting overhead. - Deterministic Accuracy Without Hallucinations: Ensures 100% accurate type restoration across complex nested maps, lists, numbers, and boolean values.
Native Usage
How to unmarshall DynamoDB JSON locally in terminal environments or scripts:
Windows (CMD / PowerShell)
# Using Node.js AWS SDK unmarshall in PowerShell
node -e "const { unmarshall } = require('@aws-sdk/util-dynamodb'); console.log(JSON.stringify(unmarshall(JSON.parse(process.argv[1])), null, 2))" '{\"pk\": {\"S\": \"user#12\"}}'Linux / Unix (Bash)
# Using Node.js AWS SDK unmarshall CLI
node -e "const { unmarshall } = require('@aws-sdk/util-dynamodb'); const data = JSON.parse(require('fs').readFileSync('item.json')); console.log(JSON.stringify(unmarshall(data), null, 2));"Python
Using boto3 in Python:
from boto3.dynamodb.types import TypeDeserializer
import json
deserializer = TypeDeserializer()
dynamodb_item = {"pk": {"S": "user#102"}, "age": {"N": "34"}}
standard_item = {k: deserializer.deserialize(v) for k, v in dynamodb_item.items()}
print(json.dumps(standard_item, indent=2))Java
Using AWS SDK for Java v2:
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
import java.util.Map;
import java.util.HashMap;
public class DynamoDbUnmarshallerExample {
public static void main(String[] args) {
Map<String, AttributeValue> item = new HashMap<>();
item.put("pk", AttributeValue.builder().s("user#102").build());
item.put("age", AttributeValue.builder().n("34").build());
String pk = item.get("pk").s();
int age = Integer.parseInt(item.get("age").n());
System.out.println("Clean record: pk=" + pk + ", age=" + age);
}
}