Constructor
# new JSONSerializer()
Concrete implementation of a Serializer in JSON format
JS's native JSON.stringify (used here) is not deterministic and therefore should not be used for hashing purposes
To keep dependencies low, we will not implement this, but we recommend
implementing a similar JSONSerializer using 'deterministic-json' libraries
- Implements:
Methods
# deserialize(str) → {T}
Rebuilds a model from a serialization
Parameters:
| Name | Type | Description |
|---|---|---|
str |
string
|
- Implements:
If it fails to parse the string, or to build the model
Error
T
# protected preSerialize(model)
prepares the model for serialization
returns a shallow copy of the object, containing an enumerable ModelKeys#ANCHOR property
so the object can be recognized upon deserialization
Parameters:
| Name | Type | Description |
|---|---|---|
model |
T
|
# serialize(model) → {string}
Serializes a model
Parameters:
| Name | Type | Description |
|---|---|---|
model |
T
|
- Implements:
if fails to serialize
Error
string