{"id":13454397,"url":"https://github.com/sindresorhus/load-json-file","last_synced_at":"2025-05-15T08:09:04.992Z","repository":{"id":1220317,"uuid":"41784492","full_name":"sindresorhus/load-json-file","owner":"sindresorhus","description":"Read and parse a JSON file","archived":false,"fork":false,"pushed_at":"2023-05-17T10:53:06.000Z","size":32,"stargazers_count":245,"open_issues_count":0,"forks_count":47,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-02-07T22:17:27.793Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/sindresorhus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/security.md","support":null,"governance":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2015-09-02T06:38:15.000Z","updated_at":"2025-01-07T20:11:13.000Z","dependencies_parsed_at":"2022-08-06T10:15:52.495Z","dependency_job_id":"f7166397-ae4e-4ca2-8bcc-d0649f75f330","html_url":"https://github.com/sindresorhus/load-json-file","commit_stats":{"total_commits":45,"total_committers":14,"mean_commits":"3.2142857142857144","dds":"0.33333333333333337","last_synced_commit":"de8256b9010db73c75a1e2036ff96025e94c0b6e"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fload-json-file","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fload-json-file/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fload-json-file/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fload-json-file/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/load-json-file/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238486163,"owners_count":19480466,"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","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":[],"created_at":"2024-07-31T08:00:53.735Z","updated_at":"2025-02-14T23:15:47.960Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","readme":"# load-json-file\n\n\u003e Read and parse a JSON file\n\nIt also strips UTF-8 [byte order mark](https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8) (BOM).\n\n## Install\n\n```\n$ npm install load-json-file\n```\n\n## Usage\n\n```js\nimport {loadJsonFile} from 'load-json-file';\n\nconsole.log(await loadJsonFile('foo.json'));\n//=\u003e {foo: true}\n```\n\n## API\n\n### loadJsonFile(filePath, options?)\n\nReturns a `Promise\u003cunknown\u003e` with the parsed JSON.\n\n### loadJsonFileSync(filepath, options?)\n\nReturns the parsed JSON.\n\n#### options\n\nType: `object`\n\n##### beforeParse\n\nType: `Function`\n\nApplies a function to the JSON string before parsing.\n\n##### reviver\n\nType: `Function`\n\nPrescribes how the value originally produced by parsing is transformed, before being returned. See the [`JSON.parse` docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Using_the_reviver_parameter) for more.\n\n## load-json-file for enterprise\n\nAvailable as part of the Tidelift Subscription.\n\nThe maintainers of load-json-file and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-load-json-file?utm_source=npm-load-json-file\u0026utm_medium=referral\u0026utm_campaign=enterprise\u0026utm_term=repo)\n\n## Related\n\n- [write-json-file](https://github.com/sindresorhus/write-json-file) - Stringify and write JSON to a file atomically\n","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://sindresorhus.com/donate","https://tidelift.com/subscription/pkg/npm-load-json-file?utm_source=npm-load-json-file\u0026utm_medium=referral\u0026utm_campaign=enterprise\u0026utm_term=repo"],"categories":["Packages","Repository","JavaScript","包","目录","Uncategorized","Filesystem"],"sub_categories":["Filesystem","Object / JSON / JSON Schema","文件系统","Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fload-json-file","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Fload-json-file","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fload-json-file/lists"}