JSFiddle - React, Tailwind, and code Playground

by Amin Kodaganur

JavaScript

var a = [{
    "id": "2",
    "recipientAddress": "[email protected]",
    "alertSeveritiesToReceive": {
      "system": "Info",
      "hardware": "Warning",
      "updater": "All",
      "webProxy": "Critical",
      "antiMalware": "All",
      "l4TrafficMonitor": "All",
      "externalUrlcategories": "Info"
    }
	}];
  
  console.log(a[0]);
  
  var temp = {};
  
  for(var propertyName in a[0]['alertSeveritiesToReceive']) {  
    temp[propertyName] = a[0]['alertSeveritiesToReceive'][propertyName];  
  }  
  delete a[0]['alertSeveritiesToReceive'];
  Object.assign(a[0], temp);
  
  console.log(a);