While putting below JSON in dynamo DB using AWS CLI with below command:
aws dynamodb put-item --table-name ScreenList --item file://tableName.json
I am getting Parameter validation failed Exception.I have gone rigorously through AWS docs but failed to find example to insert a complicated json.Every small help is welcome.
The updated Json :
{
  "itemName": {
    "S": "SCREEN_LIST"
  },
  "productName": {
    "S": "P2P_MOBITEL"
  },
  "screenList": {
    "L": [
      {
        "menu": {
          "L": [
            {
              "M": {
                "menuId": {
                  "N": "1"
                },
                "menuText": {
                  "S": "ENG_HEADING"
                },
                "menuType": {
                  "S": "Dynamic"
                }
              }
            }
          ]
        },
        "M": {
          "screenFooter": {
            "S": "F_LANGUAGE_CHANGE"
          },
          "screenHeader": {
            "S": "H_LANGUAGE_CHANGE"
          },
          "screenId": {
            "S": "LANGUAGE_CHANGE"
          },
          "screenType": {
            "S": ""
          }
        }
      }
    ]
  }
}
                It seems that you are defining complex types incorrectly. According to AWS documentation you should define a list like this:
"L": ["Cookies", "Coffee", 3.14159]
and a map should be defined like this:
"M": {"Name": {"S": "Joe"}, "Age": {"N": "35"}}
which means that a menu map should be defined like this:
"menu": { 
  "L": [
    {
      "M": {
        "menuId": {"N" :"1"},
        "menuText": {"S" :"PACKS_SCREEN"},
        "menuType": {"S" :"Dynamic"}
      }
    }
  ]
}
Notice the "M" and "L" attributes.
You should change the rest of your JSON in a similar fashion.
You can find full JSON definition here in the Options section.
UPDATE
Now your list definition is incorrect. You have:
   "screenList":{  
      "L":[  
         {  
            "menu":{ ... },
            "M":{ ... }
         }
      ]
   }
While it should be:
   "screenList":{  
      "L":[  
         {  
            "M":{ ... }   
         },
         {  
            "M":{ ... }   
         },
      ]
   }
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With