tanagra-json

Methods

(static) decodeEntity(encoded, clazz)

Deserializes a class instance that was serialized in JSON format.
Parameters:
Name Type Description
encoded Serialized instance, with class metadata.
clazz Type parameter specifying class to deserialize to.
Source:
Example
const json = require('tanagra-json')
const foo = json.decodeEntity(someSerializedJsonString, SomeDecoratedClass)

(static) encodeEntity(instance)

Serializes a decorated class instance as a JSON string.
Parameters:
Name Type Description
instance A decorated class instance.
Source:
Example
const json = require('tanagra-json')
const foo = new SomeDecoratedClass()
const serialized = json.encodeEntity(foo)