{"id":38524205,"url":"https://github.com/simpx/jsonlite","last_synced_at":"2026-01-17T06:45:13.758Z","repository":{"id":248389213,"uuid":"828111258","full_name":"simpx/jsonlite","owner":"simpx","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-02T05:13:22.000Z","size":56,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-12T20:04:13.461Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/simpx.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-13T06:40:13.000Z","updated_at":"2025-01-02T05:13:25.000Z","dependencies_parsed_at":"2024-07-14T16:14:23.537Z","dependency_job_id":null,"html_url":"https://github.com/simpx/jsonlite","commit_stats":null,"previous_names":["simpx/jsonlite"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/simpx/jsonlite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simpx%2Fjsonlite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simpx%2Fjsonlite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simpx%2Fjsonlite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simpx%2Fjsonlite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simpx","download_url":"https://codeload.github.com/simpx/jsonlite/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simpx%2Fjsonlite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28502858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T04:31:57.058Z","status":"ssl_error","status_checked_at":"2026-01-17T04:31:45.816Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2026-01-17T06:45:13.696Z","updated_at":"2026-01-17T06:45:13.740Z","avatar_url":"https://github.com/simpx.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSONLite\n\n![Build Status](https://img.shields.io/github/actions/workflow/status/simpx/jsonlite/python-package.yml)\n![PyPI](https://img.shields.io/pypi/v/jsonlite)\n![License](https://img.shields.io/github/license/simpx/jsonlite)\n![Issues](https://img.shields.io/github/issues/simpx/jsonlite)\n![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)\n\nJSONLite is a lightweight, local JSON database for simple data storage.\n- Like SQLite, it's a local database.\n- Its API is 100% modeled after MongoDB, making it easy to migrate between MongoDB and JSONLite.\n\n## Features\n\n- Zero dependency\n- Store JSON data locally\n- MongoDB-like API, Compatible with pymongo\n- Allows multiple processes to read/write concurrently\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Data Layout](#data-layout-in-json-file)\n  - [Direct Usage](#direct-usage)\n  - [Patching pymongo](#patching-pymongo-to-use-jsonlite)\n- [License](#license)\n\n## Installation\n\n```sh\npip install jsonlite\n```\n\n## Data Layout in json file\n\n```json\n{\n    \"data\": [\n        {   \"_id\": 1,\n            \"name\": \"Alice\",\n            \"age\": 30\n        },\n        {   \"_id\": 2,\n            \"name\": \"Bob\",\n            \"age\": 25\n        },\n        {   \"_id\": 3,\n            \"name\": \"Charlie\",\n            \"age\": 20\n        }\n    ]\n}\n```\n\n## Direct Usage\n\nYou can use JSONlite directly to perform CRUD operations.\n\n\n```python\n\u003e\u003e\u003e from jsonlite import JSONlite\n\n\u003e\u003e\u003e # Initialize the database\n\u003e\u003e\u003e db = JSONlite('mydatabase.json')\n\n\u003e\u003e\u003e # Inserting one document\n\u003e\u003e\u003e result = db.insert_one({\"name\": \"John Doe\", \"age\": 30})\n\u003e\u003e\u003e result.inserted_id\n1\n\n\u003e\u003e\u003e # Inserting multiple documents\n\u003e\u003e\u003e result = db.insert_many([\n...     {\"name\": \"Jane Doe\", \"age\": 25},\n...     {\"name\": \"Alice\", \"age\": 28}\n... ])\n\u003e\u003e\u003e result.inserted_ids\n[2, 3]\n\n\u003e\u003e\u003e # Finding one document\n\u003e\u003e\u003e document = db.find_one({\"name\": \"John Doe\"})\n\u003e\u003e\u003e document\n{'_id': 1, 'name': 'John Doe', 'age': 30}\n\n\u003e\u003e\u003e # Finding multiple documents\n\u003e\u003e\u003e documents = db.find({\"age\": {\"$gte\": 25}})\n\u003e\u003e\u003e documents\n[\n    {'_id': 1, 'name': 'John Doe', 'age': 30},\n    {'_id': 2, 'name': 'Jane Doe', 'age': 25},\n    {'_id': 3, 'name': 'Alice', 'age': 28}\n]\n\n\u003e\u003e\u003e # Updating one document\n\u003e\u003e\u003e result = db.update_one({\"name\": \"John Doe\"}, {\"$set\": {\"age\": 31}})\n\u003e\u003e\u003e result.matched_count, result.modified_count\n(1, 1)\n\n\u003e\u003e\u003e # Updating multiple documents\n\u003e\u003e\u003e result = db.update_many({\"age\": {\"$gte\": 25}}, {\"$set\": {\"status\": \"active\"}})\n\u003e\u003e\u003e result.matched_count, result.modified_count\n(3, 3)\n\n\u003e\u003e\u003e # Deleting one document\n\u003e\u003e\u003e result = db.delete_one({\"name\": \"John Doe\"})\n\u003e\u003e\u003e result.deleted_count\n1\n\n\u003e\u003e\u003e # Deleting multiple documents\n\u003e\u003e\u003e result = db.delete_many({\"age\": {\"$lt\": 30}})\n\u003e\u003e\u003e result.deleted_count\n2\n```\n\n## Patching pymongo to use JSONlite\nAlternatively, you can patch pymongo to use JSONlite and interact with JSON files as if you were using MongoDB. This allows you to use the familiar pymongo API with JSON data.\n\n```python\n\u003e\u003e\u003e from jsonlite import pymongo_patch\n\n\u003e\u003e\u003e pymongo_patch()\n\n\u003e\u003e\u003e from pymongo import MongoClient\n\n\u003e\u003e\u003e client = MongoClient('jsonlite://database')\n\u003e\u003e\u003e db = client.test_database\n\u003e\u003e\u003e collection = db.test_collection\n\u003e\u003e\u003e insert_result = collection.insert_one({\"name\": \"Alice\", \"age\": 30})\n\u003e\u003e\u003e # Just like using pymongo\n\u003e\u003e\u003e collection.drop()\n```\n\n# License\n\nJSONLite is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimpx%2Fjsonlite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimpx%2Fjsonlite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimpx%2Fjsonlite/lists"}