Looking at Amazon DynamoDB, I tried to figure out how to store complex objects that I create in my code and want to continue. I understand how I will store these objects in a relational database, such as MySql, but how to save them in DynamoDB?
I can think of one way ... turn them into Json and save the Json representation of the object in DynamoDB. To get them out of DynamoDB again, I would detach them from Json to my Object representation in my code.
Here is an example:
For this type of object: A car has an Engine that has many parts. Each part has a serial number, life cycle and replacement cost. Now I can turn the car into json, which will look something like this:
{
"engine": {
"parts": [
{
"serialNumber": "1234",
"lifeSpan": 10,
"replacementValue": 100
},
{
"serialNumber": "5678",
"lifeSpan": 1,
"replacementValue": 200
}
]
}
}
Json "" "Key: CarName" Jaguar ", Value [above json]? ?