toJson

Type:Function
Status:stable
Since:1.0.0
Platform:jsnode
@blackbyte.sugar.shared.object

Convert class instances to plain JSON object

Params

  1. object*-Any

    The object to convert

Return

  1. -Any

    The converted object

Example

import { toJson } from '@blackbyte/sugar/object';
class MyClass {
     hello = 'world';
     something() {}
}
toJson(new MyClass()); // => { hello: 'world' }