 <p>Use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort" rel="nofollow noreferrer"><code>Array#sort</code></a> method with custom compare function.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var data=[{"user":"a", "msg":"Hi ", "msg_count":1, "unix_time":"1474476800000"}, {"user":"b", "msg":"Hi ", "msg_count":1, "unix_time":"1478776800000"}, {"user":"c", "msg":"Hi ", "msg_count":5, "unix_time":"1479276800000"}, {"user":"d", "msg":"Hi ", "msg_count":1, "unix_time":"1478416800000"}, {"user":"e", "msg":"Hi ", "msg_count":3, "unix_time":"1478476800000"}]; data.sort(function(a, b) { // return the difference of `msg_count` property to sort based on them // if they are equal then sort based on unix_time prop return b.msg_count - a.msg_count || b.unix_time - a.unix_time; }) console.log(data)</code></pre> </div> </div> </p>