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}'  
 

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    11
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    11

Package Sidebar

Install

npm i json-decorator

Weekly Downloads

11

Version

1.0.0

License

ISC

Last publish

Collaborators

  • digital.flowers