Serializable

utils~ Serializable

Base class for objects that can be represented in JSON format.

Constructor

new Serializable()

Source:

Methods

toObject() → {object}

Generates a JSON representation of the object.

Source:

toString() → {string}

Generates a string representation of the Serializable object.

Source:

toJSON(path)

Writes the object to disk in JSON format.

Parameters:
Name Type Description
path string

the output JSON file path. The base output directory is created, if necessary

Source:

(abstract, static) fromObject(obj) → {Serializable}

Constructs a Serializable object from a JSON representation of it. Subclasses must implement this method.

Parameters:
Name Type Description
obj object

a JSON representation of a Serializable subclss

Source:

(static) fromString(str) → {Serializable}

Constructs a Serializable object from a string representation of it.

Parameters:
Name Type Description
str string

a string representation of a Serializable subclass

Source:

(static) fromJSON(path) → {Serializable}

Constructs a Serializable object from a JSON file.

Parameters:
Name Type Description
path string

the path to a JSON file

Source: