Load a JSON or YAML metadata file and return it as an object.