function objToArray (obj) { var res = []; for (var key in obj) { res.push({ label: obj[key], value: key }); } return res; }