title: Sort JSON response by key value
body: <p>Before you tag this as duplicate - I've gone through these answers: </p>
  
  <p><a href="https://stackoverflow.com/questions/36291115/sort-json-by-array-key-value">Sort JSON by array key value</a></p>
  
  <p><a href="https://stackoverflow.com/questions/20977381/sort-a-json-array-object-using-javascript-by-value">Sort a JSON array object using Javascript by value</a></p>
  
  <p>And I've tried moving the code over to my data, and it doesn't work. I've tried pushing each object item into an array as well, but that doesn't work because there's still an object inside each item. </p>
  
  <p><a href="https://imgur.com/a7LeXxF" rel="noreferrer">Here's a bit of the JSON response I get</a> (screenshot from the browser console)</p>
  
  <p>As you can see, each item has an index - what I need is to sort the response according to the index. How do I do this? </p>
  
  <p>This response is from wikipedia - as an aside. <a href="https://en.wikipedia.org/w/api.php?action=query&amp;format=json&amp;origin=*&amp;prop=info|pageimages&amp;piprop=thumbnail|name&amp;list=search&amp;generator=search&amp;inprop=url&amp;srlimit=10&amp;sroffset=1&amp;srprop=snippet&amp;gsrlimit=10&amp;gsroffset=1&amp;srsearch=Albert&amp;gsrsearch=Albert" rel="noreferrer">Here's the full API call</a>, if it helps. </p>
  
  <p>EDIT: Posting a bit of the response code here: </p>
  
  <pre><code> "pages": {
        "736": {
          "pageid": 736,
          "ns": 0,
          "title": "Albert Einstein",
          "index": 2,
          "contentmodel": "wikitext",
          "pagelanguage": "en",
          "pagelanguagehtmlcode": "en",
          "pagelanguagedir": "ltr",
          "touched": "2018-01-24T22:40:11Z",
          "lastrevid": 821432412,
          "length": 145560,
          "fullurl": "https://en.wikipedia.org/wiki/Albert_Einstein",
          "editurl": "https://en.wikipedia.org/w/index.php?title=Albert_Einstein&amp;action=edit",
          "canonicalurl": "https://en.wikipedia.org/wiki/Albert_Einstein",
          "thumbnail": {
            "source": "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3e/Einstein_1921_by_F_Schmutzer_-_restoration.jpg/38px-Einstein_1921_by_F_Schmutzer_-_restoration.jpg",
            "width": 38,
            "height": 50
          },
          "pageimage": "Einstein_1921_by_F_Schmutzer_-_restoration.jpg"
        },
        "983": {
          "pageid": 983,
          "ns": 0,
          "title": "Albert Camus",
          "index": 10,
          "contentmodel": "wikitext",
          "pagelanguage": "en",
          "pagelanguagehtmlcode": "en",
          "pagelanguagedir": "ltr",
          "touched": "2018-01-26T09:34:35Z",
          "lastrevid": 822358239,
          "length": 53639,
          "fullurl": "https://en.wikipedia.org/wiki/Albert_Camus",
          "editurl": "https://en.wikipedia.org/w/index.php?title=Albert_Camus&amp;action=edit",
          "canonicalurl": "https://en.wikipedia.org/wiki/Albert_Camus",
          "thumbnail": {
            "source": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/08/Albert_Camus%2C_gagnant_de_prix_Nobel%2C_portrait_en_buste%2C_pos%C3%A9_au_bureau%2C_faisant_face_%C3%A0_gauche%2C_cigarette_de_tabagisme.jpg/42px-Albert_Camus%2C_gagnant_de_prix_Nobel%2C_portrait_en_buste%2C_pos%C3%A9_au_bureau%2C_faisant_face_%C3%A0_gauche%2C_cigarette_de_tabagisme.jpg",
            "width": 42,
            "height": 50
          },
          "pageimage": "Albert_Camus,_gagnant_de_prix_Nobel,_portrait_en_buste,_posé_au_bureau,_faisant_face_à_gauche,_cigarette_de_tabagisme.jpg"
        },
        "46721": {
          "pageid": 46721,
          "ns": 0,
          "title": "Edward VII",
          "index": 9,
          "contentmodel": "wikitext",
          "pagelanguage": "en",
          "pagelanguagehtmlcode": "en",
          "pagelanguagedir": "ltr",
          "touched": "2018-01-26T02:00:27Z",
          "lastrevid": 821663314,
          "length": 81925,
          "fullurl": "https://en.wikipedia.org/wiki/Edward_VII",
          "editurl": "https://en.wikipedia.org/w/index.php?title=Edward_VII&amp;action=edit",
          "canonicalurl": "https://en.wikipedia.org/wiki/Edward_VII",
          "thumbnail": {
            "source": "https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Edward_VII_in_coronation_robes.jpg/35px-Edward_VII_in_coronation_robes.jpg",
            "width": 35,
            "height": 50
          },
          "pageimage": "Edward_VII_in_coronation_robes.jpg"
        }
  </code></pre>