{"id":19379725,"url":"https://github.com/joonas-yoon/json-as-db","last_synced_at":"2025-07-20T20:05:12.887Z","repository":{"id":65057782,"uuid":"581160342","full_name":"joonas-yoon/json-as-db","owner":"joonas-yoon","description":"Using JSON as very lightweight database","archived":false,"fork":false,"pushed_at":"2023-01-30T08:04:33.000Z","size":142,"stargazers_count":8,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-24T16:44:25.316Z","etag":null,"topics":["database","json","lightweight","package","pytest","python","storage","tdd-python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/json-as-db/","language":"Python","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/joonas-yoon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-12-22T12:38:43.000Z","updated_at":"2024-06-22T01:19:41.000Z","dependencies_parsed_at":"2023-02-14T03:46:01.530Z","dependency_job_id":null,"html_url":"https://github.com/joonas-yoon/json-as-db","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/joonas-yoon/json-as-db","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joonas-yoon%2Fjson-as-db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joonas-yoon%2Fjson-as-db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joonas-yoon%2Fjson-as-db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joonas-yoon%2Fjson-as-db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joonas-yoon","download_url":"https://codeload.github.com/joonas-yoon/json-as-db/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joonas-yoon%2Fjson-as-db/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262347470,"owners_count":23296893,"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","lightweight","package","pytest","python","storage","tdd-python"],"created_at":"2024-11-10T09:11:11.374Z","updated_at":"2025-07-20T20:05:12.856Z","avatar_url":"https://github.com/joonas-yoon.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003ch1\u003eJSON as DB\u003c/h1\u003e\n\n\u003cimg alt=\"PyPI Version Badge\" src=\"https://img.shields.io/pypi/v/json-as-db?style=flat-square\" /\u003e\n\u003cimg alt=\"Python Version Badge\" src=\"https://img.shields.io/pypi/pyversions/json-as-db?style=flat-square\" /\u003e\n\u003ca href=\"https://json-as-db.readthedocs.io/\"\u003e\n  \u003cimg alt=\"Read The Docs\" src=\"https://readthedocs.org/projects/json-as-db/badge/?version=latest\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/joonas-yoon/json-as-db/actions/workflows/pytest.yml\"\u003e\n  \u003cimg alt=\"PyTest Badge\" src=\"https://github.com/joonas-yoon/json-as-db/actions/workflows/pytest.yml/badge.svg\" /\u003e\u003c/a\u003e\n\n\u003c/div\u003e\n\n---\n\n**Documentation**: [https://json-as-db.readthedocs.io/](https://json-as-db.readthedocs.io/)\n\n---\n\nUsing JSON as very lightweight database.\nWork with JSON-like object for your database operations.\n\n**Major Features:**\n\n- **Simple**: define your model by typing your fields using python types, build queries\n  using python comparison operators\n\n- **Developer experience**: field/method autocompletion, type hints, data validation,\n  perform database operations with a functional API\n\n- **Fully typed**: leverage static analysis to reduce runtime issues\n\n- **Serialization**: built in JSON serialization and JSON schema generation\n\n- **Pure python implementation**: No external dependencies of packages,\n  except only for `shortuuid` to create to safe and unique ID\n\n## Quick Installation\n\nInstalling via pip:\n\n```bash\npip install json-as-db\n```\n\n## Examples\n\nLoad database from JSON file by its path, and then adding any object into database.\n\n```python\n\u003e\u003e\u003e import json_as_db as jad\n\u003e\u003e\u003e db = jad.Database()      # Declare an instance\n\u003e\u003e\u003e db.load('output.json')   # Load database from file (optional)\n\u003e\u003e\u003e db.add([{                # Add items what you want to add\n...   \"id\": \"1002\",\n...   \"type\": \"Chocolate\"\n... })\n['FqkmbYFSCRCAHQWydhM69v', 'RUJGcVBFANvNRReXa8U3En']\n```\n\nFind any in database with query-like parameters.\n\n```python\n\u003e\u003e\u003e from json_as_db import Key\n\u003e\u003e\u003e db[db.find(Key('type') == 'Chocolate')]\n{ \"id\": \"1002\", \"type\": \"Chocolate\" }\n```\n\n```python\n\u003e\u003e\u003e db[db.find((Key('age') \u003e 25) \u0026 (Key('name') == 'Charles'))]\n[{ \"age\": 33, \"name\": \"Charles\", \"job\": \"Locksmith\" }, { \"age\": 26, ... } ]\n```\n\nSave database into file as JSON format. You can read from this saved file.\nIt supports keyword parameters for JSON formatter and options to file saving.\n\n```python\n\u003e\u003e\u003e db.save('output.json', json_args={'indent': 4}, file_args={'encoding': 'utf-8'})\n\"\"\"\nThe following contents from file: output.json\n{\n    \"created_at\": \"2022-12-25T16:50:02.459068\",\n    \"creator\": \"json_as_db\",\n    \"data\": {\n        \"FqkmbYFSCRCAHQWydhM69v\": {\n            \"id\": \"1001\",\n            \"type\": \"Regular\"\n        },\n        \"RUJGcVBFANvNRReXa8U3En\": {\n            \"id\": \"1002\",\n            \"type\": \"Chocolate\"\n        }\n    },\n    \"updated_at\": \"2022-12-28T16:51:36.276790\",\n    \"version\": \"0.2.4\"\n}\n\"\"\"\n```\n\nRepresents database as follows in a table visualization.\n\n```python\n\u003e\u003e\u003e print(db)\nage  grouped  ...  job                name\n32   True     ...  Camera operator    Layne\n17   False    ...  Flying instructor  Somerled\n9    True     ...  Inventor           Joon-Ho\n...  ...      ...  ...                ...\n23   None     ...  Publican           Melanie\n54   True     ...  Racing driver      Eike\n41   None     ...  Barrister          Tanja\n\n\n[100 items, 9 keys]\n```\n\n## Benchmark\n\n|(avg. time per operation with 10K items)|json_as_db|pandas|\n|:-|-:|-:|\n|_Loads from file_|`149.11810 ms`|`153.71676 ms`|\n|_Append items_|`8.96103 ms`|`2760.27654 ms`|\n|_Search a item_|`9.87914 ms`|`2.59354 ms`|\n|_Get an item by key_|`0.0039 ms`|`0.0689 ms`|\n|_Updating a item_|`0.0074 ms`|`0.0148 ms`|\n|_Updating 5 items in a row_|`0.0130 ms`|`0.9432 ms`|\n|_Remove an item_|`0.0012 ms`|`6.0930 ms`|\n\nPlease see the details on [BENCHMARK](BENCHMARK.md).\n\n## Contributing\n\nContributing guidelines can be found [CONTRIBUTING](CONTRIBUTING.md).\n\nWelcome all contributions to the community and feel free to contribute.\n\n## License\n\nUnder the MIT license. See the [LICENSE] file for more info.\n\n---\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg alt=\"PyPI Download Badge\" src=\"https://img.shields.io/pypi/dm/json-as-db?style=flat-square\" /\u003e\n  \u003cimg alt=\"Hits Badge\" src=\"https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fjoonas-yoon%2Fjson-as-db\" /\u003e\n\u003c/div\u003e\n\n[Python Version Badge]: https://img.shields.io/pypi/pyversions/json-as-db?style=flat-square\n[PyTest Badge]: https://github.com/joonas-yoon/json-as-db/actions/workflows/pytest.yml/badge.svg\n[PyPI Version Badge]: https://img.shields.io/pypi/v/json-as-db?style=flat-square\n[PyPI Download Badge]: https://img.shields.io/pypi/dm/json-as-db?style=flat-square\n[Hits Badge]: https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fjoonas-yoon%2Fjson-as-db\n[CONTRIBUTING]: CONTRIBUTING.md\n[LICENSE]: LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoonas-yoon%2Fjson-as-db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoonas-yoon%2Fjson-as-db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoonas-yoon%2Fjson-as-db/lists"}