{"id":17472661,"url":"https://github.com/shinnn/read-json-sync","last_synced_at":"2025-04-09T22:53:37.738Z","repository":{"id":21670560,"uuid":"24991563","full_name":"shinnn/read-json-sync","owner":"shinnn","description":"Read and parse a JSON file synchronously","archived":false,"fork":false,"pushed_at":"2018-12-16T13:00:21.000Z","size":75,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T22:53:31.235Z","etag":null,"topics":["byte-order-mark","javascript","json","nodejs","parse","synchronous"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shinnn.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}},"created_at":"2014-10-09T13:58:12.000Z","updated_at":"2019-09-16T16:36:44.000Z","dependencies_parsed_at":"2022-08-17T21:10:39.893Z","dependency_job_id":null,"html_url":"https://github.com/shinnn/read-json-sync","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fread-json-sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fread-json-sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fread-json-sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fread-json-sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shinnn","download_url":"https://codeload.github.com/shinnn/read-json-sync/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125633,"owners_count":21051766,"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":["byte-order-mark","javascript","json","nodejs","parse","synchronous"],"created_at":"2024-10-18T17:30:58.208Z","updated_at":"2025-04-09T22:53:37.716Z","avatar_url":"https://github.com/shinnn.png","language":"JavaScript","readme":"# read-json-sync\n\n[![npm version](https://img.shields.io/npm/v/read-json-sync.svg)](https://www.npmjs.com/package/read-json-sync)\n[![Build Status](https://travis-ci.com/shinnn/read-json-sync.svg?branch=master)](https://travis-ci.com/shinnn/read-json-sync)\n[![Coverage Status](https://img.shields.io/coveralls/shinnn/read-json-sync.svg)](https://coveralls.io/github/shinnn/read-json-sync)\n\nA [Node.js](https://nodejs.org/) module to read and parse a [JSON](https://json.org/) file synchronously\n\n```javascript\nconst readJsonSync = require('read-json-sync');\n\nreadJsonSync('package.json'); //=\u003e {name: 'read-json-sync', version: '1.0.0', ...}\n```\n\nNode.js built-in [`require`](https://nodejs.org/api/globals.html#globals_require) and [`import`](https://nodejs.org/api/esm.html#esm_interop_with_existing_modules) can do almost the same thing, but this module doesn't [cache](https://nodejs.org/api/modules.html#modules_caching) results.\n\n## Installation\n\n[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm/).\n\n```\nnpm install read-json-sync\n```\n\n## API\n\n```javascript\nconst readJsonSync = require('read-json-sync');\n```\n\n### readJsonSync(*path* [, *options*])\n\n*path*: `string` [`Buffer`](https://nodejs.org/api/buffer.html#buffer_class_buffer) [`URL`](https://nodejs.org/api/url.html#url_class_url) (JSON filename) or `integer` (file descriptor)  \n*options*: `Object` `string` ([`fs.readFile`](https://nodejs.org/api/fs.html#fs_fs_readfile_path_options_callback) options or an encoding of the file)  \nReturn: `any` (parsed [JSON](https://tools.ietf.org/html/rfc7159) data)\n\nIt automatically ignores the leading [byte order mark](https://unicode.org/faq/utf_bom.html).\n\n```javascript\n// with-bom.json: '\\uFEFF{\"a\": 1}'\n\nJSON.parse('\\uFEFF{\"a\": 1}'); // throws a SyntaxError\n\nreadJsonSync('with-bom.json'); //=\u003e {a: 1}\n```\n\n## License\n\n[ISC License](./LICENSE) © 2017 - 2018 Shinnosuke Watanabe\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Fread-json-sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshinnn%2Fread-json-sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Fread-json-sync/lists"}