title: How to add a new property to a JSON array?
body: <p>I'm trying to append new properties to some JSON objects not at alls. How can I do that?</p>
  
  <p>For example, this is my JSON array:</p>
  
  <pre><code>var eventsArray;
  
      eventsArray = [
  
      {
          "title" : "Marco 1",
          "user": "Marco",
          "start" : "2016-01-12T16:00:00-05:00",
          "end" : "2016-01-12T17:00:00-05:00"
      }, {
          "title" : "Marco 2",
          "user": "Marco",
          "start" : "2016-01-12T10:00:00-05:00",
          "end" : "2016-01-12T12:00:00-05:00"
      }, {
          "title" : "Marta 1",
          "user": "Marta",
          "start" : "2016-01-12T09:00:00-05:00",
          "end" : "2016-01-12T10:00:00-05:00"
      }, {
          "title" : "Marta 2",
          "user": "Marta",
          "start" : "2016-01-13T09:00:00-05:00",
          "end" : "2016-01-13T10:00:00-05:00"
      }, {
          "title" : "Veronica 1",
          "user": "Veronica",
          "start" : "2016-01-12T13:00:00-05:00",
          "end" : "2016-01-12T14:00:00-05:00"
      }, {
          "title" : "Veronica 2",
          "user": "Marco",
          "start" : "2016-01-11T13:00:00-05:00",
          "end" : "2016-01-11T14:00:00-05:00"
      }
  
      ];
  </code></pre>
  
  <p>And then I need to add a new property, such as "color" : "red" to the user Veronica, i.e.:</p>
  
  <pre><code>var eventsArray;
  
  eventsArray = [
  
  {
      "title" : "Marco event 1",
      "user": "Marco",
      "start" : "2016-01-12T16:00:00-05:00",
      "end" : "2016-01-12T17:00:00-05:00"
  }, {
      "title" : "Marco event 2",
      "user": "Marco",
      "start" : "2016-01-12T10:00:00-05:00",
      "end" : "2016-01-12T12:00:00-05:00"
  }, {
      "title" : "Marta event 1",
      "user": "Marta",
      "start" : "2016-01-12T09:00:00-05:00",
      "end" : "2016-01-12T10:00:00-05:00"
  }, {
      "title" : "Marta event 2",
      "user": "Marta",
      "start" : "2016-01-13T09:00:00-05:00",
      "end" : "2016-01-13T10:00:00-05:00"
  }, {
      "title" : "Veronica event 1",
      "user": "Veronica",
      "start" : "2016-01-12T13:00:00-05:00",
      "end" : "2016-01-12T14:00:00-05:00",
      "color" : "red"
  }, {
      "title" : "Veronica event 2",
      "user": "Veronica",
      "start" : "2016-01-11T13:00:00-05:00",
      "end" : "2016-01-11T14:00:00-05:00",
      "color" : "red"
  }
  
  ];
  </code></pre>
  
  <p>Here above I just added (manually) the "color" : "red" only to the objects having "user" === "Veronica" (the latter two). How I can do this via JavaScript?</p>
  
  <p>I tried some ways without success, such as:</p>
  
  <pre><code>eventsArray[4].color = "red";
  eventsArray[5].color = "red";
  </code></pre>
  
  <p>or:</p>
  
  <pre><code>eventsArray.user["Veronica"].color = "red";
  eventsArray.user["Veronica"].color = "red";
  </code></pre>
  
  <p>Is from a few days I'm learning to use JSON.</p>
  
  <p>Please note that in this specific case there will be not any problems having objects with different properties: my program will not explode! :P</p>
  
  <p>Thank you.</p>