javascript - How to assign JSON object -
i'm new in angularjs. i'm trying assign json objects , i'm using object.assign assign json objects. can't result want please me result.
'use strict' let 1 ={"start":"11","dashboard":"1","settings":"2","support":"3","trunk":"4","routing":"5","solutions":"6","accounting":"7","statistic":"8","marketing":"9","profile":"10"}; let 2 = {"settings":{"basic settings":"1","number range":"2","employess":"3","message fulfillment":"4"},"support":{"all contacts":"5","detail approval":"6","incomplete signup":"7","settings":"8"},"trunk":{"my tickets":"9","all tickets":"10"}}; let three = {"settings":{"basic settings":{"my information":"1","bank information":"2"}}}; let 4 = object.assign({}, one, two, three); console.log(json.stringify(four));
try :
function mergeobjects() { var merged_obj = {}; (i in arguments) { obj = arguments[i]; (j in obj) { merged_obj[j] = obj[j]; } } return merged_obj; } var 1 ={"start":"11","dashboard":"1","settings":"2","support":"3","trunk":"4","routing":"5","solutions":"6","accounting":"7","statistic":"8","marketing":"9","profile":"10"}; var 2 = {"settings":{"basic settings":"1","number range":"2","employess":"3","message fulfillment":"4"},"support":{"all contacts":"5","detail approval":"6","incomplete signup":"7","settings":"8"},"trunk":{"my tickets":"9","all tickets":"10"}}; var 3 = {"settings":{"basic settings":{"my information":"1","bank information":"2"}}}; var mergedobj = mergeobjects(one, two, three); console.log(mergedobj);
Comments
Post a Comment