[Solved] Map the JSON key and update the value in another JSON using angular2


You can use Object.keys() to iterate over the keys of your first json object. Object.keys() returns a string array containing the key names. So we can call .forEach() on that result. In the foreach method we can use the key to access the child object in secondJsonObj.

Object.keys(firstJsonObj).forEach(key => {
    if (secondJsonObj[key]) {
        secondJsonObj[key].value = firstJsonObj[key]
    }
});

solved Map the JSON key and update the value in another JSON using angular2