title: How to modify values fromJSON
body: <p>Please consider the following view:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;p&gt;Count &lt;span data-bind="text: unreadCount()"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
  &lt;div data-bind='template: { name: "conversationTemplate", data: currentList }'&gt; &lt;/div&gt;
  &lt;script type="text/html" id="conversationTemplate"&gt;
   &lt;table&gt;
    &lt;tbody&gt;
     {{each $data}}
      &lt;tr id="conversation_${conversation_id}" class="conversation-item ${status}"&gt;
       &lt;td&gt;&lt;input type="checkbox" data-bind="click: function() { alert(this.value) }, checked: read" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
     {{/each}}
    &lt;/tbody&gt;
   &lt;/table&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>And the following code:</p>
  
  <pre><code>$(function() {
  
   var viewModel = {
    currentList : ko.observableArray([])
   };
  
   ko.dependentObservable(function () {
    $.ajax({
     url: '/conversations/inbox.json', dataType: 'json',
     success: function(data) {
      viewModel.currentList(data.conversationlist);
     }
    });  
   }.bind(viewModel));
  
   viewModel.unreadCount = ko.dependentObservable(function() {
    var unreadCount = 0;
    for (var i = 0; i &lt; viewModel.currentList().length; i++)
     if (viewModel.currentList()[i].read == true) {
      unreadCount++;
     }
    return unreadCount;
   });
  
   ko.applyBindings(viewModel);
  </code></pre>
  
  <p>The above appears to be working, though I'm not sure if I built this correctly. What I want to learn how to do is when you change a <em>checkbox</em>, how to have the <code>unreadCount</code> be automatically updated to reflect the change. I thought that using ko would provide this automatically, but maybe I need to do something in the template's checkbox data-bind? </p>
  
  <p>Also, once I can modify the checkbox and have that automatically update the View Model &amp; Unread count, what is the right way to then post that update back to the server (Rails)?</p>
  
  <p>Here's an example JSON response from server:</p>
  
  <pre><code>{
      "conversationlist": [{
          "project_name": "Proj 1",
          "preview": "xxxxx",
          "status": "unread",
          "participants": [{
              "image": "XXXXXX"
          }, {
              "image": "XXXXXX"
          }],
          "conversation_id": 193,
          "title": "Hi Ho",
          "time_ago": "1 day",
          "read": true
      }, {
          "project_name": "Proj 2",
          "preview": "xxxx",
          "status": "unread",
          "participants": [{
              "image": "XXXXXX"
          }, {
              "image": "XXXXXX"
          }],
          "conversation_id": 193,
          "title": "Hi Ho",
          "time_ago": "1 day",
          "read": true
      }, {
          "project_name": "Proj 3",
          "preview": "xxxxx",
          "status": "unread",
          "participants": [{
              "image": "XXXXXX"
          }, {
              "image": "XXXXXX"
          }],
          "conversation_id": 193,
          "title": "Hi Ho",
          "time_ago": "1 day",
          "read": true
      }]
  }
  </code></pre>