I have a simple JSON array that I am trying set a map key on using a variable. The array uses the map functionality of DynamoDB and the first map called 'hours' contains a nested Map that I want to have a key of 15. However becuase I want that key to change depending on the hour of the day, I passed a variable into the JSON array nested map key that would reflect that.
For the following I just hard coded it to 15 to simplify the problem.
The issue is that DynamoDB does in fact run the putItem with this in there it changes the variable hour to just a string "hour" and ignores the value of the set variable during the operation. Any ideas on how to pass the variable value to the key name?
var hour = "15";
"hours" : {"M" : {
hour : {"M" : { //The hour variable is used as a key
"action1" : {"N" : "1"},
"action2" : {"N" : "1"}
}
}
}
}