You can avoid having to create a function by referencing the first entry returned from Object.keys():
var firstKey = Object.keys(data)[0];
For the first entry from a sorted key list, simply add a call to the .sort() method:
var firstKey = Object.keys(data).sort()[0];