title: Add dynamic key-values to JSON object
body: <p>I'm trying to create a json object in javascript containing dynamic values. I need to pass this JSON Object to server through an AJAX call. But I'm unable to add the dynamic values.</p>
  
  <pre><code>var finalJSONObj={};
  for loop(int i = 0; i&lt;10;i++){
      // gets the values of rows i need to add .. 
      var taskValue = tasks[i]; // need to add this in the JSON Object
  }
  </code></pre>
  
  <p>My final JSON object should look like:</p>
  
  <pre><code>finalJSONObj = {
      tasks1: 'taskValue',
      tasks2: 'taskValue',
      tasks3: 'taskValue',
      tasks4: 'taskValue',
      userId: 'abcd',
      date: '23/09/2016'
  };
  </code></pre>
  
  <p>Need to add the "taskValue" retrieved from the for loop for each task in the JSON Object. Any Thoughts?</p>