## Modules
jsclass-serializer

A module for de/serializing objects.

## Classes
Serializable
## Functions
constructor(baseclass)

"jsclass-serializer" provides features to serialize and deserialize to memory and to file in json format. Deserializing returns instance of original class.

## jsclass-serializer A module for de/serializing objects. ## Serializable **Kind**: global class * [Serializable](#Serializable) * [new Serializable()](#new_Serializable_new) * _instance_ * [.serialize()](#Serializable+serialize) ⇒ json * [.saveToFile()](#Serializable+saveToFile) ⇒ json * [.deserialize(json)](#Serializable+deserialize) * [.loadFromFile(uuid)](#Serializable+loadFromFile) * _static_ * [.setStoragePath(p)](#Serializable.setStoragePath) * [.saveToFile(o, filename)](#Serializable.saveToFile) ⇒ json * [.loadFromFile(filename)](#Serializable.loadFromFile) ⇒ any * [.loadAll(Callback)](#Serializable.loadAll) ⇒ Array * [.serialize(o)](#Serializable.serialize) ⇒ json * [.deserialize(json)](#Serializable.deserialize) ### new Serializable() Serializable object and deserialize back to its original class instance. Also supports save/load to/from file system. ### serializable.serialize() ⇒ json Serialize object to json format. **Kind**: instance method of [Serializable](#Serializable) **Returns**: json - Json text. ### serializable.saveToFile() ⇒ json Save serialized json object to file. Where directory path would be the path previously set by setStoragePath(), and file name would be set equally to given objects uuid. **Kind**: instance method of [Serializable](#Serializable) **Returns**: json - Json text. ### serializable.deserialize(json) Deserialize json text to object **Kind**: instance method of [Serializable](#Serializable) | Param | Type | Description | | --- | --- | --- | | json | json | [description] | ### serializable.loadFromFile(uuid) Load json text from file and convert to object. Where directory path would be the path previously set by setStoragePath(). **Kind**: instance method of [Serializable](#Serializable) | Param | Type | Description | | --- | --- | --- | | uuid | string | Unique identifier to specify the file to load from. | ### Serializable.setStoragePath(p) Set directory path to save/load serialized information to/from file. **Kind**: static method of [Serializable](#Serializable) | Param | Type | Description | | --- | --- | --- | | p | string | Absolute or relative directory path | ### Serializable.saveToFile(o, filename) ⇒ json Save serialized json object to file. Where directory path would be the path previously set by setStoragePath(). This method can serialize any type of object. **Kind**: static method of [Serializable](#Serializable) **Returns**: json - Json text. | Param | Type | Description | | --- | --- | --- | | o | any | Object to serialize. | | filename | string | Filename to save object. | ### Serializable.loadFromFile(filename) ⇒ any Load json text from file and convert to object. Where directory path would be the path previously set by setStoragePath(). This method can deserialize any file with json text. **Kind**: static method of [Serializable](#Serializable) **Returns**: any - Deserialized object. | Param | Type | Description | | --- | --- | --- | | filename | string | Filename to load json from. | ### Serializable.loadAll(Callback) ⇒ Array Load all json files under storage directory. **Kind**: static method of [Serializable](#Serializable) **Returns**: Array - Retrieved objects. | Param | Type | Description | | --- | --- | --- | | Callback | function | function applies to retrieved objects. | ### Serializable.serialize(o) ⇒ json Serialize object to json format. This method can serialize any type of object. **Kind**: static method of [Serializable](#Serializable) **Returns**: json - Json text. | Param | Type | Description | | --- | --- | --- | | o | any | Object to serialize. | ### Serializable.deserialize(json) Deserialize json text to object This method can deserialize any file with json text. **Kind**: static method of [Serializable](#Serializable) | Param | Type | Description | | --- | --- | --- | | json | json | [description] | ## constructor(baseclass) "jsclass-serializer" provides features to serialize and deserialize to memory and to file in json format. Deserializing returns instance of original class. **Kind**: global function | Param | Type | Description | | --- | --- | --- | | baseclass | any | Set "this", when use with jsclass-mixin. |