code: function resourceToJsonObject (resource) {
      var result = {};
  
      for (var prop in resource) {
  
        if (prop === '_links') {
          if (Object.keys(resource._links).length > 0) {
            // Note: we need to copy data to remove "rel" property without corrupting original Link object
            result._links = Object.keys(resource._links).reduce(function (links, rel) {
              if (Array.isArray(resource._links[rel])) {
                links[rel] = new Array()
                for (var i=0; i < resource._links[rel].length; i++)
                  links[rel].push(resource._links[rel][i].toJSON())
              } else {
                var link = resource._links[rel].toJSON();
                links[rel] = link;
                delete link.rel;
              }
              return links;
            }, {});
          }
  
        } else if (prop === '_embedded') {
          if (Object.keys(resource._embedded).length > 0) {
            // Note that we do not reformat _embedded
            // which means we voluntarily DO NOT RESPECT the following constraint:
            // > Relations with one corresponding Resource/Link have a single object
            // > value, relations with multiple corresponding HAL elements have an
            // > array of objects as their value.
            // Come on, resource one is *really* dumb.
            result._embedded = {};
            for (var rel in resource._embedded) {
              result._embedded[rel] = resource._embedded[rel].map(resourceToJsonObject);
            }
          }
  
        } else if (resource.hasOwnProperty(prop)) {
          result[prop] = resource[prop];
        }
      }
  
      return result;
    }
docs: Convert a resource to a stringifiable anonymous object
  @private
  @param Resource resource