JSFiddle - React, Tailwind, and code Playground

HTML

var obj2 = {
	a: {
  	b: "hallo",
    c: "bye"
  },
  d: 'h'
}

var mess2 = {
	arguments: {
    messageBody: {
      message: "ciao"
    },
    template: 'temp',
    subject: 'hallo leute',
    to: {
        '[email protected]': 'Accounts team'
      }
  }
}  


var mess2 = {
	arguments: {
    messageBody: {
      message: "ciao"
    },
    template: 'temp',
    subject: 'hallo leute',
    to: {
        '[email protected]': 'Accounts team'
      }
  }
}

JavaScript

function formatObjects(obj) {
	for(var key in obj) {
    if(Array.isArray(obj[key])) {
      obj[key].map(function(item) {
      	formatObjects(item);
      });
    } else if(Object.prototype.toString.call( obj[key] ) === '[object Object]') { 
      console.log(key, ':');
      formatObjects(obj[key]);
      
    }
    
    else {
      console.log(key,': ', obj[key]);
    }
  }
}

var mess1 = {
	arguments: [
    {
      messageBody: {
      	message: "Simon Munnery and Pat Cahill Edinburgh previews @ The Old Queen's Head ha"
      },
      template: "email-admin-notification",
      subject: "Invoice reminder: Simon Munnery and Pat Cahill Edinburgh previews",
      to: {
        "[email protected]": "Accounts Team"
      }
    }
   ]
 };



formatObjects(mess1);
// formatObjects(mess2);