title: Sorted list using knockout.js with json data
body: <p>I am building a sorted list using knockout.js. I have a version working with a simple observable array but how can I make it work with my json data and using the mapping plugin?</p>
  
  <p><a href="http://jsfiddle.net/infatti/x66Ts/" rel="nofollow">http://jsfiddle.net/infatti/x66Ts/</a></p>
  
  <pre><code>        // Here is my json data
          var viewModel;
          $.getJSON('http://echo.jsontest.com/name/Stuart', function (data) {
              viewModel = ko.mapping.fromJS(data);
              ko.applyBindings(viewModel);
          });
  
  // Here is my working version of the simple observable array. How can it work using json data and the mapping plugin?
  var ListSortModel = function () {
  
    // my items
      this.allItems = ko.observableArray([
          { name: 'Denise' },
          { name: 'Charles' },
          { name: 'Bert' }
      ]); 
  
      // sorter
      this.sortItems = function() {
          this.allItems(this.allItems().sort(function(a, b) { return a.name &gt; b.name;}));
      };
  };
  
  ko.applyBindings(new ListSortModel());
  </code></pre>