JSFiddle - React, Tailwind, and code Playground
by skram
JavaScript
var obj = {
"name": "john",
"Age": "21",
"sex": "male",
"place": {
"state": "ca"
}
};
var output = allKeysToUpperCase(obj);
function allKeysToUpperCase(obj) {
var output = {};
for (i in obj) {
if (Object.prototype.toString.apply(obj[i]) === '[object Object]') {
output[i.toUpperCase()] = allKeysToUpperCase(obj[i]);
} else {
output[i.toUpperCase()] = obj[i];
}
}
return output;
}