DynamoDB JSON or Standard JSON?

Viewed 312

My old project has data in Standard JSON format in MySQL.

For my completely new project in JS (Node.js) and DynamoDB, about the data in Standard JSON format:

  • Is it advisable to convert it to DynamoDB JSON?
  • What advantages does DynamoDB JSON have over Standard JSON?
  • Will it be easier to parse the data?
  • Or does it integrate more with other AWS services like AppSync with GraphQL?
  • Or is it enough to handle it as a string?
  • Is there something I didn't consider?

Standard JSON

{ updated_at: 146548180, uuid: 'foo', status: 'new' }

DynamoDB JSON

{"updated_at":{"N":"146548180"},"uuid":{"S":"foo"},"status":{"S":"new"}}
1 Answers

The main benefit of the DynamoDB JSON is that you explicitly set the datatype, which is useful for the internal representation DynamoDB uses, aside from that I don't see any of them. I'm also not aware of any other AWS service that uses the same DynamoDB-JSON flavor.

In my experience, DynamoDB-JSON is just more annoying to work with, because of the additional data conversions it requires.

I prefer to use regular JSON in combination with a JSON-schema in order to enforce data types and format.

  • Or is it enough to handle it as a string?

That may be advantageous in some use cases, but if you use the DynamoDB-JSON structures, you're able to set additional indexes on the fields and even create attribute-level permissions if you require that.

Related