Sort the keys instead of grouping them using a Javascript object.