title: What would be the best way to order a json object by an index found within each of it's properties?
body: <p>I have an array of objects like so</p>
  
  <pre><code>obj = [
      {
        id: 3,
        data: foo
      },
      {
        id: 7,
        data: bar
      }
  ]
  </code></pre>
  
  <p>but I need to get it to </p>
  
  <pre><code> obj = {
      3: {
          id: 3,
          data: foo
      },
      7: {
          data: bar
      }
   }
  </code></pre>
  
  <p>having the id in the sub object is not needed but might be handy. What would be the best way to achieve this? I am not sure if there is a simple way to extract a property as an index?</p>
  
  <p>Thanks for any help!</p>