Skip to main content

FastJson-db

A lightweight JSON-based database for Python.
fastjson-db allows you to store, retrieve, and manipulate data in a simple JSON file with a minimal and easy-to-use API.

Features

  • Lightweight and simple to use
  • CRUD operations: insert, get, update, delete
  • Automatic unique IDs for records
  • Optional fast backend using orjson if installed
  • Human-readable JSON file

Installation

The currently newest version is [0.3.5].

pip install fastjson-db

Examples

Some basic examples on how to user FastJson-db

Creating a Class

To manipulate JsonTables, you need to create a JsonModel subclass (dataclass), so the JsonTable only accepts that especific JsonModel subclass.

from fastjson_db import JsonModel
from dataclasses import dataclass

@dataclass
class User(JsonModel):
    _id: int
    name: str = ""
    password: str = ""

It's obrigatory using _id field or it will not result in error when quering.

Creating a JsonTable

JsonTables are the ones inserting and updating your dataclasses in .json files. They will automaticly create and facilitate the usage of .json "tables", trying to simulate a simple database.

from fastjson_db import JsonModel, JsonTable
from dataclasses import dataclass

@dataclass
class User(JsonModel):
    _id: int = 0
    name: str = ""
    password: str = ""
    
user = User(name="Allan", password="123")

user_table = JsonTable("users.json", User)

📚 Complete Docs
📝 Changelog
🛣️ Roadmap
🤝 Contributing

PyPI License

Metadata

Release files for fastjson-db 0.3.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastjson-db 0.3.5
File Size Uploaded
fastjson_db-0.3.5.tar.gz 10.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fastjson-db 0.3.5
File Interpreter ABI Platform
fastjson_db-0.3.5-py3-none-any.whl Python 3 none any Details

Total release size: 22.3 kB

Release files / fastjson_db-0.3.5.tar.gz

Download URL fastjson_db-0.3.5.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
37ae8b89b1e8fa5bea029e39d41bcec7ac6da8fa230deca89fe7f49e12d837d1
BLAKE2b-256 checksum
How to use checksums
99956fcf7f85e2f1051d4d580074f7881f7692182262eaf35a4081130f2ba883
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / fastjson_db-0.3.5-py3-none-any.whl

Download URL fastjson_db-0.3.5-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
376ef5122fd72358f8aeaa2193da4a44dd92257a8f5e42cfc5b605b933f7e4ef
BLAKE2b-256 checksum
How to use checksums
79f8323944b84d0f92a83c45469f8695169f0f4d5671ce2e6d90307b0815b4da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

0.3.5 This release

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page