I want to create JSON object using pure JavaScript as below:
{
  "0": {
     "0": {
          "key1": 1,
          "key2": 2
     },
     "1": {
          "key1": 1,
          "key2": 2
      }
  }
  "1": {
     "0": {
          "key1": 1,
          "key2": 2
      }
  }
}
But when I try below code I get error for undefined:
var myJosnObj = {};
myJosnObj["0"]["0"] = {"key1": 1,"key2": 2};
I am getting error:
Error: myJosnObj[0] is undefined
I want to either create or update the existing key in the json document.
 
     
    