{"id":22059769,"url":"https://github.com/harukayamamoto0/jsonforenv","last_synced_at":"2026-04-09T20:11:21.940Z","repository":{"id":176225159,"uuid":"655180432","full_name":"HarukaYamamoto0/jsonforenv","owner":"HarukaYamamoto0","description":"a json reader for env","archived":false,"fork":false,"pushed_at":"2023-11-05T02:04:19.000Z","size":6,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-04T05:39:49.339Z","etag":null,"topics":["dotenv","env","jsonforenv","portfolio"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/jsonforenv","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HarukaYamamoto0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-18T06:11:48.000Z","updated_at":"2025-01-20T15:02:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"827516b4-5007-467a-bae3-630fafb90492","html_url":"https://github.com/HarukaYamamoto0/jsonforenv","commit_stats":null,"previous_names":["harukayamamoto0/jsonforenv"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HarukaYamamoto0/jsonforenv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarukaYamamoto0%2Fjsonforenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarukaYamamoto0%2Fjsonforenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarukaYamamoto0%2Fjsonforenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarukaYamamoto0%2Fjsonforenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HarukaYamamoto0","download_url":"https://codeload.github.com/HarukaYamamoto0/jsonforenv/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarukaYamamoto0%2Fjsonforenv/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266807202,"owners_count":23987427,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotenv","env","jsonforenv","portfolio"],"created_at":"2024-11-30T17:32:22.730Z","updated_at":"2026-04-09T20:11:21.890Z","avatar_url":"https://github.com/HarukaYamamoto0.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jsonforenv\n\n\u003cimg src=\"https://imgur.com/0QoUUjl.png\" alt=\"jsonforenv\" align=\"right\" width=\"200\" /\u003e\n\njsonforenv is a simple tool that simplifies the configuration of environment variables. With it, you can easily load environment variables from a JSON configuration file, making your application configuration more organized and flexible.\n\n![GitHub stars](https://img.shields.io/github/stars/HarukaYamamoto0/jsonforenv?color=informational)\n![GitHub fork](https://img.shields.io/github/forks/HarukaYamamoto0/jsonforenv?color=informational)\n![GitHub license](https://img.shields.io/github/license/HarukaYamamoto0/jsonforenv?color=informational)\n\n## Installation\n\nYou can install it via npm or yarn:\n\n```bash\nnpm install jsonforenv\n# Or\nyarn add jsonforenv\n```\n\n## Usage\n\nFirst create a `.json` file, in the location you want.\n\n```json\n{\n  \"DATABASE_URL\": \"mongodb://localhost/mydb\",\n  \"SECRET_KEY\": \"mysecretkey\",\n  \"DEBUG_MODE\": true\n}\n```\n\nimport the library into your code:\n\n```javascript\nimport { loadEnvFromFile, loadEnvFromFolder } from \"jsonforenv\";\n```\n\nIf you want to load just one configuration file, call the `loadEnvFromFile` function passing the path to the JSON file containing the environment variables:\n\n```javascript\nloadEnvFromFile(\"path/to/your/config.json\");\n```\n\nNow if you want to load several configuration files that are inside a folder, call the `loadEnvFromFolder` function passing the path to the folder containing the .json files:\n\n```javascript\nloadEnvFromFolder(\"path/to/your/folder\");\n```\n\nIf the JSON file found is valid, the environment variables will be loaded based on the settings provided in the file, as in the example below:\n\n```javascript\nimport { loadEnvFromFile } from \"jsonforenv\";\nloadEnvFromFile();\n\nconsole.log(process.env.DATABASE_URL); // mongodb://localhost/mydb\nconsole.log(process.env.SECRET_KEY); // mysecretkey\n```\n\n### FAQ\n\n#### Does it throw errors?\n\n`jsonforenv` handles errors during the JSON file loading process. If errors occur when reading the file, parsing the JSON, or if the file is not found, the library will throw appropriate errors to inform the user of the problem.\n\nHere is an example of how to catch errors when using `jsonforenv`:\n\n```javascript\ntry {\n  loadEnvFromFile(\"path/to/your/config.json\");\n} catch (error) {\n  console.error(error.message);\n  // Do something about the error if necessary\n}\n```\n\n## Contributing\n\nContributions are welcome! Feel free to open issues and submit pull requests to improve this package.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n\n## Assignments\n\n- **Logo:** \u003ca href=\"https://www.flaticon.com/free-icons/gear\" title=\"gear icons\"\u003eGear icons created by Freepik - Flaticon\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharukayamamoto0%2Fjsonforenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharukayamamoto0%2Fjsonforenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharukayamamoto0%2Fjsonforenv/lists"}