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
2018-07-24 00:38:54 +02:00
dist initial 2017-02-27 14:05:03 +01:00
test BREAKING CHANGE(scope): change scope 2018-07-24 00:38:54 +02:00
ts BREAKING CHANGE(scope): change scope 2018-07-24 00:38:54 +02:00
.gitignore initial 2017-02-27 14:05:03 +01:00
.gitlab-ci.yml BREAKING CHANGE(scope): change scope 2018-07-24 00:38:54 +02:00
package-lock.json 2.0.0 2018-07-24 00:38:54 +02:00
package.json 2.0.0 2018-07-24 00:38:54 +02:00
README.md BREAKING CHANGE(scope): change scope 2018-07-24 00:38:54 +02:00
tsconfig.json BREAKING CHANGE(scope): change scope 2018-07-24 00:38:54 +02:00
tslint.json initial 2017-01-28 15:23:26 +01:00

smartjson

typed json handlers

Availabililty

npm git git docs

Status for master

build status coverage report npm downloads per month Dependency Status bitHound Dependencies bitHound Code 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 { Foldable, foldDec } from 'smartjson';

class AwesomeClass extends Foldable {
  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