contract/lib/BeanState.js
/**
     * Deserialize object into one of a set of supported JSON classes
     * i.e. Convert serialized data to JSON object
     * Typically used after getState() ledger API
     * @param {object} dataToDeserialize Data to deserialize into JSON object.
     * @param {string} supportedClasses The set of classes data can be serialized to the system.
     * @return {json} JSON with the data to store.
     */
Deserialize object into one of a set of supported JSON classes
i.e. Convert serialized data to JSON object
Typically used after getState() ledger API
@param {object} dataToDeserialize Data to deserialize into JSON object.
@param {string} supportedClasses The set of classes data can be serialized to the system.
@return {json} JSON with the data to store.
Deserialize object into one of a set of supported JSON classes i . e . Convert serialized data to JSON object Typically used after getState () ledger API @param { object } dataToDeserialize Data to deserialize into JSON object . @param { string } supportedClasses The set of classes data can be serialized to the system . @return { json } JSON with the data to store .
static deserialize(dataToDeserialize, supportedClasses) {
        logWrite(`[deserialize] supportedClasses = ${supportedClasses}`);
        logWrite(`[deserialize] data = ${dataToDeserialize}`);
        if (dataToDeserialize == null || dataToDeserialize == undefined) { return; }
        if (!BeanState.isJson(dataToDeserialize)) {
            logWrite(`[deserialize] data to deserialize Is Not JSon type`);
            return null;
        }
        let json = JSON.parse(dataToDeserialize);
        let objClass = supportedClasses[json.class];
        if (objClass == null || objClass == undefined) {
            throw new Error(`Unknown class of ${json.class}`);
        }
        let object = new (objClass)(json);
        return object;
    }
static deserialize ( dataToDeserialize , supportedClasses ) { logWrite ( ` ${ supportedClasses } ` ) ; logWrite ( ` ${ dataToDeserialize } ` ) ; if ( dataToDeserialize == null || dataToDeserialize == undefined ) { return ; } if ( ! BeanState . isJson ( dataToDeserialize ) ) { logWrite ( ` ` ) ; return null ; } let json = JSON . parse ( dataToDeserialize ) ; let objClass = supportedClasses [ json . class ] ; if ( objClass == null || objClass == undefined ) { throw new Error ( ` ${ json . class } ` ) ; } let object = new ( objClass ) ( json ) ; return object ; }
Deserialize object into one of a set of supported JSON classes
 i.e.
Deserialize object into one of a set of supported JSON classes i . e .