-1

i need the below array format data in nodejs serverless Dynamodb

i need my output like the below json format how to i get it the format

"user": {
 "e8de014a-22c1-12bf-4653-577c8031138":{
   "email": "mailto:rajm@gm.com",
   "method": [
    "email"
   ],
   "name": "Raj",
   "onDemand": "yes",
   "pollSchedule": "None",
   "pollTarget": "Educator",
   "telephone": "12345678",
   "user_id": "413ca05f-ed91-50e7-1974-3e0280ca4a3d"
  },
  "5f4db059-c8a3-e673-iygk-d857425e1077": {
   "created_at": 1674459043374,
   "email": "mailto:test@gmail.com",
   "method": [
    "email"
   ],{
   "name": "New testing",
   "onDemand": "yes",
   "pollSchedule": "None",
   "pollTarget": "Educator",
   "telephone": "12345678",
   "user_id": "413ca05f-ed91-50e7-2635-3e0280ca4a3d"
  }
 }
Deva
  • 3
  • 5

1 Answers1

0

Use the DynamoDB Document Client to Put and Get the data as it's native JSON format.

The DynamoDB document client simplifies working with items by abstracting the notion of attribute values. This abstraction annotates native JavaScript types supplied as input parameters, as well as converts annotated response data to native JavaScript types.

Leeroy Hannigan
  • 11,409
  • 3
  • 14
  • 31
  • we are using a update Document Client class for a ddata so how can we get the format in serverless dynamodb – Deva Mar 30 '23 at 08:49
  • we need the data format for a data like a reputation score increse and decrese value on that case we need that data format as like above – Deva Mar 30 '23 at 08:54
  • we tried with a 'map_put()' function can u suggest any idea?to format the output – Deva Mar 30 '23 at 08:56
  • Your ask is not clear. If you want to save the item you shared in your question then you simply cal `Put` with the DocumentClient. – Leeroy Hannigan Mar 30 '23 at 09:27
  • i cant try put becoz i updating the value the output of value will be the above json format so there i am using a update function in DocumentClient – Deva Mar 31 '23 at 06:48