I want to change json key but I can not manage
I tried to write a function:
modifySlotKey(requestObjectIntent, slotValue) {
requestObjectIntent['slots']['toChange'] = requestObjectIntent['slots'][slotValue]
return requestObjectIntent;
}
but it doesn't work.
My json is like that:
"slots": {
  "toChange": {
    "name": "query",
    "value": "torte",
    "confirmationStatus": "NONE",
    "source": "USER"
  }
}
but I want to change it to:
"slots": {
  "slotValue": {
    "name": "query",
    "value": "torte",
    "confirmationStatus": "NONE",
    "source": "USER"
  }
}
Could somebody help me please to solve this issue?
 
     
    