Fix Package.toJson and improve diagnostic output in case of JSON parsing errors.
Don't try to determine the default configuration before downloading all dependencies.