Skip to content

Instantly share code, notes, and snippets.

@alexpilugin
Created February 1, 2019 11:27
Show Gist options
  • Save alexpilugin/782848132808d583c877c4421069abe1 to your computer and use it in GitHub Desktop.
Save alexpilugin/782848132808d583c877c4421069abe1 to your computer and use it in GitHub Desktop.
var arr = [
{key:"11", value:"1100"},
{key:"22", value:"2200"}
];
var obj = arr.reduce(function(obj,item) {
obj[item.key] = item.value;
return obj;
},{});
console.log(JSON.stringify(obj));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment