Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Easiest way to Store JSON typed data using a Pydantic models and database-like structure.
StoreJSON is the easiest way to manage data with JSON. It allows you to store, manipulate, and query objects in table form, similar to a database, but with the simplicity and readability of the JSON format. This project is designed to be as accessible as possible while remaining powerful enough for various use cases.
Simplicity: With StoreJSON, working with structured data becomes as simple as manipulating Python objects. No complex configuration is needed. Everything is managed through classes.
Performance: The use of typed models via Pydantic. enables efficient data validation while ensuring data integrity.
Readability: Storing data in JSON format ensures that your data remains easily readable and modifiable, even without specific tools.
from storejson import Storage, TableObject
# Create a new storage instance using a JSON file
storage = Storage("./mystorage.json")
# Define a data model for the "users" table
class UserModel(TableObject):
id: int
username: str
# Add the "users" table to the storage
User = storage.add_table("users", id_key="id", model_class=UserModel)
# Create a new user and add them to the table
user = User(id=1, username="JohnDoe")
user.storage.push()
# Retrieve a user by their ID
retrieved_user = User.get(1)
print(retrieved_user)
# Update a user
retrieved_user.username = "JaneDoe"
retrieved_user.push()
# Delete a user
retrieved_user.remove()
If you prefer to use decorators for more concise syntax:
# Create a "users" table using a decorator
@storage.table("users", id_key="id")
class User(TableObject):
id: int
username: str
# Create and add a user
user = User(id=2, username="Alice")
user.storage.push()
# Retrieve and display the user
print(User.storage.get(2))
To view the full documentation of the project, it is recommended to use pdoc
.
pip install pdoc
py -m pdoc storejson
FAQs
Easiest way to Store JSON typed data using a Pydantic models and database-like structure.
We found that storejson demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.