How to do convert array of objects like this:
[ { display_name: \"view_dashboard\", value: 1 }, { display_name: \"view_user\",
You can try Array.map
Array.map
var data = [{ display_name: "view_dashboard", value: 1 }, { display_name: "view_user", value: 0 }]; var result = data.map(function(o){ var _tmp = {}; _tmp[o.display_name] = o.value return _tmp; }); document.write("" + JSON.stringify(result,0,4) + "");
" + JSON.stringify(result,0,4) + "