Sign inSign up

olpa/ddb_convert

By olpa

•Updated 9 months ago

A lightweight tool to convert between DynamoDB JSON format and normal JSON.

Image
Developer tools
Databases & storage
0

1.4K

olpa/ddb_convert repository overview

⁠DynamoDB JSON Converter

A lightweight tool to convert between DynamoDB JSON format and normal JSON.

⁠Usage

Command: ddb_convert [OPTIONS] <MODE>

Arguments:

  • <MODE> - Conversion mode:
    • from-ddb - Convert DynamoDB JSON to normal JSON
    • to-ddb - Convert normal JSON to DynamoDB JSON

Options:

  • -i, --input <INPUT> - Input file (stdin if not specified)
  • -o, --output <OUTPUT> - Output file (stdout if not specified)
  • -p, --pretty - Pretty print output JSON
  • --without-item - Omit top-level "Item" wrapper (only applies to to-ddb mode)
  • -h, --help - Print help
  • -V, --version - Print version

⁠Examples

⁠Convert to DynamoDB format (stdin/stdout)

Command:

echo '{"name":"Alice","age":30}' | docker run --rm -i olpa/ddb_convert to-ddb

Output:

{"Item":{"name":{"S":"Alice"},"age":{"N":"30"}}}

Convert from DynamoDB format (using file mount)

Input file data.json:

{"Item":{"name":{"S":"Alice"},"age":{"N":"30"}}}

When working with files, mount your working directory to /data. Command:

docker run --rm -v $(pwd):/data olpa/ddb_convert from-ddb -i data.json

Output:

{"name":"Alice","age":30}

⁠Source Code

Available at: https://github.com/olpa/streaming_json/tree/master/examples/dynamodb⁠

Tag summary

Content type

Image

Digest

sha256:df1cc4c4e…

Size

556.2 kB

Last updated

9 months ago

docker pull olpa/ddb_convert