class-to-json
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

class-to-json

Serialization strategy for classes.

/**
 * Converts a class instance to a JSON serializable object, enumerating non enumerable members.
 */
export function classToJSON<T>(instance: T): T;
 
/** Custom symbol that can be used to override a given object serialization */
classToJSON.customunique symbol
 
/**
 * Base class that supports serialization of not enumerable members as JSON.
 * Private and protected fields starting with _ will be ignored when serializing.
 */
export abstract class SerializableClass {
  /**
   * Returns a representation of this class that is serializable to JSON.
   */
  toJSON(): this
}

license

MIT License

Copyright (c) 2020, Salvatore Previti

Readme

Keywords

Package Sidebar

Install

npm i class-to-json

Weekly Downloads

2

Version

0.0.2

License

MIT

Unpacked Size

13.9 kB

Total Files

7

Last publish

Collaborators

  • salvatorepreviti