Jsoning is a simplified wrapper for Node.js that lets you write and read data to and from JSON files. It's designed to be beginner-friendly and easy to use, with a simple API that makes it easy to get started with. It's perfect for small projects, prototyping, and learning how to work with databases.
Features
- Use existing JSON files to read and write key-value pairs
- EventEmitters to listen to changes in the database
- Atomic file writing to prevent data corruption
- Easier to use than a toaster
- TypeScript support for all the fixed-type addicts out there
Install
Node.js v16.x or greater is required for this package to work.
npm i jsoning
pnpm i jsoning
yarn add jsoning
View the full documentation here.
Basic Usage
import { Jsoning, MathOps } from 'jsoning';
const db = new Jsoning('database.json');
await db.set('birthday', '07-aug');
await db.set('age', '13');
await db.push('transformers', 'optimus prime');
await db.push('transformers', 'bumblebee');
await db.push('transformers', 'iron hide');
console.log(await db.get('transformers'));
console.log(await db.all());
console.log(await db.has('value2'));
console.log(await db.delete('age'));
await db.set('money', 100);
await db.math('money', MathOps.Add, 200);
console.log(await db.get<number>('money'));
await db.remove('transformers', 'iron hide');
await db.clear();
Contributing
Please see CONTRIBUTING.md for more details on contributing!
Contributors

Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification.
Contributions of any kind are welcome!
License
This package is open sourced under the MIT License.
