Jsoning is a lightweight, key-value JSON-based persistent database library designed for Node.js environments. It currently maintains version 1.0.1 and has a moderate release cadence, with significant updates like the v1.0.0 TypeScript rewrite. The library focuses on ease of use and beginner-friendliness, providing a simple API for common database operations such as setting, getting, pushing, and deleting data within JSON files. Key differentiators include atomic file writing to prevent data corruption, built-in TypeScript support, and EventEmitter integration for reacting to database changes, making it suitable for small projects, prototyping, and educational purposes. It requires Node.js v16 or greater for operation.
npm install jsoningVerified import paths — ran on the pinned version, not inferred.
This example demonstrates basic CRUD operations using Jsoning, including setting and getting key-value pairs, manipulating arrays with push and remove, performing arithmetic operations, and clearing the entire database. It ensures a clean start and uses explicit file path handling for clarity.
Migrate your project to use ES modules (`type: 'module'` in `package.json` or `.mjs` files) and replace `require()` with `import { Jsoning } from 'jsoning';`. Ensure your Node.js version is 16 or greater.Update your code to check for `null` instead of `false` when determining if a key exists after a `get()` call (e.g., `if (value === null)` or `if (value == null)`).
Always provide an absolute path to the `Jsoning` constructor, or ensure your application explicitly sets or manages its current working directory if relying on relative paths.
Upgrade to jsoning v0.9.18 or higher to patch the prototype pollution vulnerability.
Always use `await` before calling `jsoning` methods within an `async` function, or handle the returned Promises with `.then().catch()`.
Change your import statement to `import { Jsoning } from 'jsoning';` and ensure your environment supports ES modules (Node.js >=16 with `type: 'module'` in `package.json`).Ensure all calls to `jsoning` methods are `await`ed within an `async` function. For example, `await db.set('key', 'value');`.Provide an absolute path to the `Jsoning` constructor (e.g., `new Jsoning(path.join(__dirname, 'data', 'my-db.json'))`) to ensure the file is always accessed from a predictable location.
Add `import { MathOps } from 'jsoning';` to your file alongside the `Jsoning` import.No dependency data recorded yet.