json-decorator

1.0.0 • Public • Published

classy-decorator

Dynamically generate toJSON serialization method for javascript ES6 classes ;)

install

npm i json-decorator --save

very easy to use

import json from "json-decorator";
 
@json("b","d") // pass the property names that you want to ignore
class Clazz {
    constructor(a,b,c,d) {
        this.a = a;
        this.b = b;
        this.c = c;
        this.d = d;
    }
}
 
console.log(JSON.stringify(new Clazz(1,2,3,4))); // '{"a":1,"c":3}'  
 

Dependencies (1)

Dev Dependencies (6)

Package Sidebar

Install

npm i json-decorator

Weekly Downloads

4

Version

1.0.0

License

ISC

Last publish

Collaborators

  • digital.flowers