alditis
alditis

Reputation: 4817

DynamoDB JSON or Standard JSON?

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:

Standard JSON

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

DynamoDB JSON

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

Upvotes: 5

Views: 1549

Answers (1)

Maurice
Maurice

Reputation: 13117

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.

Upvotes: 4

Related Questions