Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ops-gaurav/json-serializer-deserializer

Reading Writing JSON config files made easy
https://github.com/ops-gaurav/json-serializer-deserializer

Last synced: 23 days ago
JSON representation

Reading Writing JSON config files made easy

Awesome Lists containing this project

README

        

# JSON Serializer Deserialize

JSON serializer deserialize makes the Read/Write operations on the JSON files easily. The applications employing the config files in JSON could utilize this plugin by simply importing the module and avoiding interating with the `fs` module. Focus only on reading, updating and saving the JSON.

> Now support for typescript. prior updates to 1.0.2

## Installation
1. Run the following command to install
`npm install json-serialize-deserialize`.

## Usage and snippets
var jsonSerializer = require('json-serialize-deserialize');
jsonSerializer.readFile ('path.to.config.json')
.then ((fileData) => {
// do something with the filedata

fileData.revenue = 9809;

jsonSerializer.writeFile ('path.to.config.json')
.then ((val) => {
console.log ('write success')
}).catch ((err) => {
console.error (err);
})
}).catch ((err) => {
console.error (err);
});