A library for handling typed JSON data, providing functionalities for parsing, stringifying, and working with JSON objects, including support for encoding and decoding buffers.
Go to file
2019-05-05 19:01:19 +02:00
test BREAKING CHANGE(core): renamed Folable to Smartjson and added deterministic stringify 2019-02-14 23:16:34 +01:00
ts fix(core): update 2019-05-05 19:01:19 +02:00
.gitignore initial 2017-02-27 14:05:03 +01:00
.gitlab-ci.yml BREAKING CHANGE(core): renamed Folable to Smartjson and added deterministic stringify 2019-02-14 23:16:34 +01:00
.snyk fix(security): add snyk policy 2019-02-14 23:21:03 +01:00
npmextra.json BREAKING CHANGE(core): renamed Folable to Smartjson and added deterministic stringify 2019-02-14 23:16:34 +01:00
package-lock.json 3.0.2 2019-05-05 19:01:19 +02:00
package.json 3.0.2 2019-05-05 19:01:19 +02:00
README.md BREAKING CHANGE(core): renamed Folable to Smartjson and added deterministic stringify 2019-02-14 23:16:34 +01:00
tsconfig.json fix(core): update 2019-05-05 19:01:19 +02:00
tslint.json BREAKING CHANGE(core): renamed Folable to Smartjson and added deterministic stringify 2019-02-14 23:16:34 +01:00

@pushrocks/smartjson

typed json handlers

Status for master

build status coverage report npm downloads per month Known Vulnerabilities TypeScript node JavaScript Style Guide

Usage

Use TypeScript for best in class instellisense.

Classes

SmartJson makes it easy to fold and enfold classes into and from JSON

import { Smartjson, foldDec } from 'smartjson';

class AwesomeClass extends Smartjson {
  static stringify


  computedValue: string;

  @foldDec() // mark anotherValueToStore as foldable
  anotherValueToStore: string = null;
  constructor() {
    super(); // this is important
  }
}

let myAwesomeInstance = new AwesomeClass();
let foldedObject = myAwesomeInstance.foldToObject(); // will return {anotherValueToStore: null}
myAwesomeInstance.enfoldFromObject({ anotherValueToStore: 'hi' });
foldedObject = myAwesomeInstance.foldToObject(); // will return {anotherValueToStore: 'hi'}

For further information read the linked docs at the top of this readme.

MIT licensed | © Lossless GmbH | By using this npm module you agree to our privacy policy

repo-footer