obj = { "Name": "chevrolet chevelle malibu", "Cylinders": 8, "Displacement": 307, "Horsepower": 130, "Weight_in_lbs": 3504, "Origin": "USA", "in_production": false } const typesMap = { 'boolean': 'checkbox', 'number': 'number', 'string': 'text' }; let str = "\n" for (var name in obj) { value = obj[name]; type = typeof value; htmlType = typesMap[type]; str += ` ${name}: \n`; } str += "" document.write(str) alert(str)