Skip to content

Instantly share code, notes, and snippets.

@lsmith
Created August 30, 2009 20:21
Show Gist options
  • Save lsmith/178116 to your computer and use it in GitHub Desktop.
Save lsmith/178116 to your computer and use it in GitHub Desktop.
var before = {
"12": "John",
"100": "Mary"
};
var after = [],
k;
for (k in before) {
if (before.hasOwnProperty(k)) {
after.push({ value: k, label: before[k] });
}
}
// after is now
[
{ value: "12", label: "John" },
{ value: "100", label: "Mary" }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment