1. // http://stackoverflow.com/a/10196772/173630
  2. function allKeysToLowerCase(obj) {
  3.     var output = {};
  4.     for (i in obj) {
  5.         if (Object.prototype.toString.apply(obj[i]) === '[object Object]'
  6.             || Object.prototype.toString.apply(obj[i]) === '[object Array]'
  7.         ) {
  8.             output[i.toLowerCase()] = allKeysToLowerCase(obj[i]);
  9.         } else {
  10.             output[i.toLowerCase()] = obj[i];
  11.         }  
  12.     }          
  13.     return output;
  14. }