Commit a91412df authored by William Naslund's avatar William Naslund

Added model toJSON() method

parent 83f59795
......@@ -118,6 +118,16 @@ export class DBModel {
return str + ' }';
}
toJSON(): any {
const encoded: any = {};
for(const field of getTableFields(this.constructor) || []) {
encoded[String(field.propertyKey)] = this[field.propertyKey];
}
return encoded;
}
}
export interface DBModel {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment