json-decorator
v1.0.0
Published
Dynamically generate toJSON serilization method for javascript ES6 classes ;)
Downloads
81
Maintainers
Readme
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}'