@madissia/json-reader

1.0.3 • Public • Published

JSONReader

A simple JSON reader and writer

Usage

// test.json
/*
{
	"timesRead": 0
}
*/
const JSONReader = require('@madissia/json-reader')

// Read JSON file
let json = JSONReader('test.json')

// Access data
if(!json.timesRead) // if data doesn't exist, create it
	json.timesRead = 0
console.log('"test.json" has been read ' + json.timesRead + ' times')

// Change data, doesn't affect file
json.timesRead += 1

// Write changes to file
json.save()

License

Released under the MIT License

Package Sidebar

Install

npm i @madissia/json-reader

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

6.72 kB

Total Files

5

Last publish

Collaborators

  • klemze