Javascript – Add element to array if it exist
I have a nested Json Object payload={ abc:"abc", something:[somevalue:"somevalue",nestedAray:[{anotherValue:"anotherValue"},{optionalValue:"optionalValue",optionalValue1:"optionalValue1"}]] } here optionalValue1 key is optional in the payload. Need map the same JSON object to the new new Json with different Key names ecpected output: { name:"abc", skills:[Java:"somevalue","JSLibrary":[{JavaScript:"anotherValue"},{Angular:"optionalValue",NodeJs:"optionalValue1"}]] } I…