code: function(a, b) {
  
              function sort(object) {
                  if (typeof object !== "object" || object === null) {
                      return object;
                  }
  
                  return Object.keys(object).sort().map(function(key) {
                      return {
                          key: key,
                          value: sort(object[key])
                      };
                  });
              }
  
              return JSON.stringify(sort(a)) === JSON.stringify(sort(b));
          }
docs: need to modify it little bit By Chris O'Brien, prettycode.org