{"id":15653420,"url":"https://github.com/nettofarah/json-crate","last_synced_at":"2025-04-30T21:41:41.784Z","repository":{"id":57284742,"uuid":"88377989","full_name":"nettofarah/json-crate","owner":"nettofarah","description":"📦 json-crate: a minimalistic promise-based json database","archived":false,"fork":false,"pushed_at":"2017-08-30T18:39:52.000Z","size":11,"stargazers_count":29,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-25T06:16:28.478Z","etag":null,"topics":["database","json","json-database","minimalistic","testing-tools"],"latest_commit_sha":null,"homepage":"","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/nettofarah.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-15T22:38:38.000Z","updated_at":"2023-05-08T13:25:33.000Z","dependencies_parsed_at":"2022-08-25T07:23:00.808Z","dependency_job_id":null,"html_url":"https://github.com/nettofarah/json-crate","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nettofarah%2Fjson-crate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nettofarah%2Fjson-crate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nettofarah%2Fjson-crate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nettofarah%2Fjson-crate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nettofarah","download_url":"https://codeload.github.com/nettofarah/json-crate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242711044,"owners_count":20173266,"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":["database","json","json-database","minimalistic","testing-tools"],"created_at":"2024-10-03T12:45:38.544Z","updated_at":"2025-03-09T15:30:47.507Z","avatar_url":"https://github.com/nettofarah.png","language":"JavaScript","readme":"# json-crate\n📦 minimalistic promise-based json database\n\njson-crate is a super simple json database for quick hacks or when you\nneed to persist simple json files.\n\n## Features\n\n- Fetch specific properties from a JSON file\n- Write/Update properties to a JSON file\n\n\n## Installation\n```\n$ npm install json-crate\n```\n\n## Usage\nGiven a JSON file:\n```json\n{\n  \"bakery\": {\n    \"bread\": [\n      \"sourdough\", \"french baguette\"\n    ],\n    \"desert\": [\n      \"blueberry muffins\", \"chocolate croissant\"\n    ]\n  },\n  \"household\": {\n    \"cleaning-products\": {\n      \"dish-detergents\": [\n        \"Method Dish Soap Lemon Mint\", \"Meyers Clean Day Liquid Dish Soap\"\n      ]\n    }\n  }\n}\n```\n\n### Reading JSON data\n\n```javascript\nconst { loadAt, writeAt } = require(\"json-crate\")\n\n// You can load a specific property\nloadAt(\"./tmp/groceries.json\", \"bakery.bread\").then(bread =\u003e {\n  console.log(bread)\n  // =\u003e [\"sourdough\", \"french baguette\"]\n})\n\n// Load an item in an array\nloadAt(\"./tmp/groceries.json\", \"bakery.bread[1]\").then(bread =\u003e {\n  console.log(bread)\n  // =\u003e \"french baguette\"\n})\n```\n\njson-crate uses lodash\"s [object path](https://lodash.com/docs/4.17.4#get) notation to read and write nested properties in the json file.\n\n### Writing JSON data\n\nYou can create new nested properties or update existing ones using the same [object notation](https://lodash.com/docs/4.17.4#set) as before.\n\n```javascript\nwriteAt(\"./tmp/groceries.json\", \"frozen.ice-cream\", [\n  \"chocolate chip cookie\",\n  \"french vanilla\"\n])\n```\n\nWill update our `groceries.json` file with:\n```json\n{\n  \"bakery\": {\n    \"bread\": [\n      \"sourdough\", \"french baguette\"\n    ],\n    \"desert\": [\n      \"blueberry muffins\", \"chocolate croissant\"\n    ]\n  },\n  \"household\": {\n    \"cleaning-products\": {\n      \"dish-detergents\": [\n        \"Method Dish Soap Lemon Mint\", \"Meyers Clean Day Liquid Dish Soap\"\n      ]\n    }\n  },\n  \"frozen\": {\n    \"ice-cream\": [\n      \"chocolate chip cookie\",\n      \"french vanilla\"\n    ]\n  }\n}\n```\n\n## Notes\n\nYou can think of `json-crate` as a couple of convenience wrappers for dealing with simple objects you may want to persist.\n\nThis library is not intended for production usage and does not provide any data consistency guarantees such as concurrent access, locking of any kind or indexing.\n\nSome great use-cases for `json-crate`:\n- test fixtures\n- configuration files\n- managing environment variables\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/nettofarah/json-crate. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Code of Conduct](https://github.com/nettofarah/json-crate/blob/master/CODE_OF_CONDUCT.md).\n\nTo run the specs check out the repo and follow these steps:\n\n```bash\n$ yarn install\n$ yarn test\n```\n\n## License\n\nThe module is available as open source under the terms of the MIT License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnettofarah%2Fjson-crate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnettofarah%2Fjson-crate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnettofarah%2Fjson-crate/lists"}