{"id":23990,"library":"localdb-json","title":"localdb-json","description":"A helper script for easily handling JSON files as a local database. Provides a simple class to load, manipulate, and save data persisted in a JSON file. Intended for small-scale local storage needs. Version 1.0, no active development observed.","status":"active","version":"1.0","language":"python","source_language":"en","source_url":"https://github.com/buddhhu/localdb.json","tags":["json","database","local","storage"],"install":[{"cmd":"pip install localdb-json","lang":"bash","label":"pip"}],"dependencies":[],"imports":[{"note":"Hyphens in package name must be replaced with underscores in import statement.","wrong":"import localdb-json\nfrom localdb-json import JSONDatabase","symbol":"JSONDatabase","correct":"from localdb_json import JSONDatabase"}],"quickstart":{"code":"from localdb_json import JSONDatabase\n\ndb = JSONDatabase('data.json')\ndb['users'] = [{'name': 'Alice', 'age': 30}]\ndb.save()\nprint(db['users'])","lang":"python","description":"Basic usage: create a JSONDatabase instance, assign data, call save()."},"warnings":[{"fix":"Use underscore in import: from localdb_json import JSONDatabase","message":"The library uses a hyphen in the package name (localdb-json). When importing in Python, you must replace hyphens with underscores: `from localdb_json import JSONDatabase`. Attempting `import localdb-json` will raise a syntax error.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Always call db.save() after making changes to write to disk.","message":"JSONDatabase saves data back to the file only when .save() is called explicitly. Modifying the in-memory dict does not persist automatically.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Use only in single-threaded, single-process scenarios, or implement your own locking mechanism.","message":"The library does not handle concurrent access. Writing from multiple processes or threads may cause corruption or data loss.","severity":"gotcha","affected_versions":">=1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Replace hyphen with underscore: `from localdb_json import JSONDatabase`","cause":"Using a hyphen in import statement instead of underscore.","error":"SyntaxError: invalid syntax when using `import localdb-json`"},{"fix":"Initialize the database with a structure: db = JSONDatabase('data.json', default={'users': []}) or set key before accessing.","cause":"Calling db['users'] before saving when initializing a new database without setting that key.","error":"KeyError: 'users' after appending data"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}