How to create another object from an existing object? [closed]

This will do the transforms you need (as discussed in the comments, no more keys are expected, values are always the same as labels, etc):

let currentObj =  {
          "partnerId": "1",
          "platform": {
              "label": "ADP",
              "value": "ADP"
          "subPlatform": {
              "value": "Health",
              "label": "Health"
          "activeIndicator": {
              "value": "Inactive",
              "label": "Inactive"
          "partnerNotes": "",
          "ignore_whitespace": false
let expected = {
    platform: currentObj.platform.value,
    subPlatform: currentObj.subPlatform.value,
    activeIndicator: currentObj.activeIndicator.value,

delete expected.ignore_whitespace;


Browse More Popular Posts

Leave a Comment