How do I sort this JSON Object by price in Javascript? : <p>I have a JSON object that I'd like to sort by price from least to greatest.</p>

<pre><code>{
 "BEY": {
  "1": {
    "price": 2280,
    "airline": "QR",
  },
  "2": {
    "price": 2108,
    "airline": "UA",
  }
 },
 "BKK": {
  "1": {
    "price": 2956,
    "airline": "QR",
  },
  "2": {
    "price": 1718,
    "airline": "WS",
  }
 }
}
</code></pre>

<p>I'd like to re-format it so that the key is the price of the airplane ticket. For example:</p>

<pre><code>{ 
  1718: {
   "airline" : "WS",
   "IATA_Code" : "BKK"
  },
  2108: {
   "airline" : "UA",
   "IATA_Code" : "BEY"
  },
  2280: {
   "airline" : "QR",
   "IATA_Code" : "BEY"
  },
  2956: {
   "airline" : "QR",
   "IATA_Code" : "BKK"
  }
}
</code></pre>
