Skip to content

Instantly share code, notes, and snippets.

@web-zen
Created August 30, 2009 19:29
Show Gist options
  • Select an option

  • Save web-zen/178094 to your computer and use it in GitHub Desktop.

Select an option

Save web-zen/178094 to your computer and use it in GitHub Desktop.
console.log(jsUsers);
//returns Object 12=Abraham,Zac 166=Anderson,James 81=Aubin,Richard
var users = {};
users['value']={};
users['label']={};
for (i in jsUsers) {
users['value'][i]=i;
users['label'][i]=users[i]
}
console.log(users);
// returns Object value=Object label=Object
I need a format like:
var users= [
{value:'12',label:'Smith,Zac'},
{value:'166',label:'Jones,James'},
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment