Typed JSON Converter for DynamoDB

Turn DynamoDB’s typed JSON into plain JSON, and plain JSON into typed JSON you can send to DynamoDB. Paste the output of aws dynamodb scan, an export to S3 or a stream record, and get clean data back with every digit of every number kept. It runs in your browser.

Nothing you paste leaves this page. The tool doesn’t send anything anywhere, and the page’s security policy stops it from fetching or loading anything from another site, so your table data stays on your machine.

On a wide screen you can open it full screen.

How to Use It

  1. Paste or load your JSON. One item, a list of items, one item per line, or the output of a Scan, Query, GetItem or BatchGetItem call. Exports to S3 in DynamoDB JSON and DynamoDB Streams records work too.
  2. Let it pick the direction. If every value is wrapped in a type, you get plain JSON. Otherwise you get typed JSON. You can set the direction yourself.
  3. Choose how lists become sets, when the result is typed JSON. By default a list stays a list (L). You can turn lists of unique strings into string sets (SS) and lists of unique numbers into number sets (NS).
  4. Copy or download the result. For loading data, choose batch-write-item requests: 25 items to a request, one request per line, with the shell loop that sends them.

What Typed JSON Is

DynamoDB gives every attribute a type, and its API writes each value wrapped in that type. {"name": {"S": "Ana"}, "visits": {"N": "17"}} is the typed form of {"name": "Ana", "visits": 17}. The codes are S for text, N for numbers, B for binary, BOOL, NULL, M for maps, L for lists, and SS, NS and BS for sets.

Numbers travel as text for a reason. DynamoDB keeps up to 38 significant digits, while a JavaScript number keeps about 15 to 17, and so do most JSON libraries. Convert a large ID or an exact amount the usual way and it comes out changed. This converter reads JSON with its own parser and never turns a number into floating point, so 12345678901234567890123456789012345678 stays exactly that.

How It Was Tested

The converter was checked against the AWS SDK for JavaScript, @aws-sdk/util-dynamodb 3.996.9:

  • 3,000 random documents holding 10,963 numbers gave the same result as the SDK in both directions.
  • Seven numbers at DynamoDB’s limits, such as 38-digit integers and 1E-130, matched the SDK’s exact mode digit for digit.
  • 500 documents with lists of unique values became the same sets the SDK builds from JavaScript Set objects.

The Code

The converter’s logic is one JavaScript file with no dependencies, open source under the Apache License 2.0. It runs as this page, as a command line in Node.js, and inside your own code:

aws dynamodb scan --table-name users > scan.json
node typed-json/cli.js scan.json > users.json

The full manual and the tests are in the typed-json folder on GitHub. The other tools work the same way.