Called when deserialising JSON, to re-create the object graph
based upon element/relationship IDs.
975993
public void hydrate() {
        if (viewSet == null) {
            viewSet = createViewSet();
        }

        if (documentation == null) {
            documentation = createDocumentation();
        }

        hydrateModel();
        hydrateViewSet();
        hydrateDocumentation();
    }
1193458
function deserialize(Clazz, json) {
    /**
     * As it is a recursive function, ignore any arguments that are unset
     */
    if (hasAnyNullOrUndefined(Clazz, json)) {
        return void 0;
    }
    /**
     * Prevent non-json continue
     */
    if (!utils_1.isTargetType(json, 'object')) {
        return void 0;
    }
    /**
     * init root class to contain json
     */
    var instance = new Clazz();
    Object.keys(instance).forEach(function (key) {
        /**
         * get decoratorMetaData, structure: { name?:string, clazz?:{ new():T } }
         */
        var decoratorMetaData = getJsonProperty(instance, key);
        /**
         * pass value to instance
         */
        if (decoratorMetaData && decoratorMetaData.customConverter) {
            instance[key] = decoratorMetaData.customConverter.fromJson(json[decoratorMetaData.name || key]);
        }
        else {
            instance[key] = decoratorMetaData ? mapFromJson(decoratorMetaData, instance, json, key) : json[key];
        }
    });
    return instance;
}
1028715
function(obj) { 
   if(!this.nodes[obj.id]) {  
     var edges = this.edges[obj.id] = {};
     this.nodes[obj.id] = new Graph.Node($.extend({
        'id': obj.id,
        'name': obj.name,
        'data': obj.data || {},
        'adjacencies': edges 
      }, this.opt.Node), 
      this.opt.complex, 
      this.Node, 
      this.Edge,
      this.Label);
    }
    return this.nodes[obj.id];
  }
227225
def from_json(cls, json_graph):
        
        obj = json.loads(json_graph)

        vertices = [
            AnnotatedVertex(
                id=vertex["id"],
                annotation=vertex["annotation"],
            )
            for vertex in obj["vertices"]
        ]

        edges = [
            AnnotatedEdge(
                id=edge["id"],
                annotation=edge["annotation"],
                head=edge["head"],
                tail=edge["tail"],
            )
            for edge in obj["edges"]
        ]

        return cls(vertices=vertices, edges=edges)
721072
public void rebuild(StaplerRequest req, JSONObject json, List<? extends Descriptor<T>> descriptors) throws FormException, IOException {
        List<T> newList = new ArrayList<>();

        for (Descriptor<T> d : descriptors) {
            T existing = get((D)d);
            String name = d.getJsonSafeClassName();
            JSONObject o = json.optJSONObject(name);

            T instance = null;
            if (o!=null) {
                if (existing instanceof ReconfigurableDescribable)
                    instance = (T)((ReconfigurableDescribable)existing).reconfigure(req,o);
                else
                    instance = d.newInstance(req, o);
            } else {
                if (existing instanceof ReconfigurableDescribable)
                    instance = (T)((ReconfigurableDescribable)existing).reconfigure(req,null);
            }

            if (instance!=null)
                newList.add(instance);
        }

        replaceBy(newList);
    }
781225
function populateOriginalKeyDetails (json, originalKey) {
  const properties = [
    'id',
    'name'
  ]

  properties
    .filter(jsonProp => !json.hasOwnProperty(jsonProp))
    .forEach(jsonProp => {
      json[jsonProp] = originalKey
    })
}
745092
function(json, indices) {
                            //                console.log("seperateProcessing:");
                            //                console.log("json = "+JSON.stringify(json));
                            for (var t=minTime; t<=maxTime; ) {
                                //                    console.log("t = "+t);
                                var nextTime = maxTime + 1; // break condition
                                var sum = 0; // for mean adjusted graphs
                                var hadValue = [];
                                for (var s=0; s<json.length; s++) {
                                    hadValue.push(false);
                                    if (indices[s] >= json[s].dps.length) {
                                        // skip this one
                                    }
                                    else if (json[s].dps[indices[s]][0] == t) {
                                        hadValue[s] = true;
                                        var val = json[s].dps[indices[s]][1];
                                        if (isNegativeSquashingEnabled(json[s]) && val < 0) {
                                            json[s].dps[indices[s]][1] = 0;
                                            val = 0;
                                        }
                                        indices[s]++;
                                        if (indices[s] < json[s].dps.length) {
                                            nextTime = Math.min(nextTime, json[s].dps[indices[s]][0]);
                                        }
                                        if (dygraphOptions.ratioGraph) {
                                            sum += Math.abs(val);
                                        }
                                        else if (dygraphOptions.meanAdjusted) {
                                            sum += val;
                                        }
                                    }
                                    else {
                                        nextTime = Math.min(nextTime, json[s].dps[indices[s]][0]);
                                    }
                                }
                                if (dygraphOptions.ratioGraph) {
                                    for (var s=0; s<json.length; s++) {
                                        if (hadValue[s] && json[s].dps[indices[s]-1][1]!=null && !isNaN(json[s].dps[indices[s]-1][1])) {
                                            json[s].dps[indices[s]-1][1] = (json[s].dps[indices[s]-1][1] * 100) / sum;
                                        }
                                    }
                                    ignoredBecause = "ratio graphs";
                                }
                                else if (dygraphOptions.meanAdjusted) {
                                    var mean = sum / json.length;
                                    for (var s=0; s<json.length; s++) {
                                        //                            console.log("s = "+s);
                                        //                            console.log("indices[s] = "+indices[s]);
                                        if (hadValue[s] && json[s].dps[indices[s]-1][1]!=null && !isNaN(json[s].dps[indices[s]-1][1])) {

                                            //                                console.log("val = "+json[s].dps[indices[s]-1][1]);
                                            //                                console.log("mean = "+mean);
                                            json[s].dps[indices[s]-1][1] -= mean;
                                        }
                                    }
                                    ignoredBecause = "mean adjustment";
                                }
                                else {
                                    if (dygraphOptions.y1AutoScale) {
                                        for (var s=0; s<json.length; s++) {
                                            if (isY1Axis(json[s].aardvark_query.graphOptions.axis)) {
                                                if (hadValue[s] && json[s].dps[indices[s]-1][1]!=null && !isNaN(json[s].dps[indices[s]-1][1])) {
                                                    json[s].dps[indices[s]-1][1] *= scaleMultiplierByMetricNameY1[json[s].metric];
                                                }
                                            }
                                        }
                                        ignoredBecause = "auto scaling";
                                    }
                                    if (dygraphOptions.y2AutoScale) {
                                        for (var s=0; s<json.length; s++) {
                                            if (isY2Axis(json[s].aardvark_query.graphOptions.axis)) {
                                                if (hadValue[s] && json[s].dps[indices[s]-1][1]!=null && !isNaN(json[s].dps[indices[s]-1][1])) {
                                                    json[s].dps[indices[s]-1][1] *= scaleMultiplierByMetricNameY2[json[s].metric];
                                                }
                                            }
                                        }
                                        ignoredBecause = "auto scaling";
                                    }
                                }
                                t = nextTime;
                            }
                        }
444046
def from_dict(cls, jobj):
        '''
        '''
        try:
            obj = cls.__new__(cls)
            blacklist = set(['__class__', '__type__'] + cls.__blacklist)
            for k in set(jobj.keys()) - blacklist:
                setattr(obj, k, jobj[k])

            return obj
        except Exception as e:
            raise TypeError('Failed to deserialise {}: {} - args: {}'.format(cls.__name__, str(e), kwargs))
952942
def to_json(graph: BELGraph) -> Mapping[str, Any]:
    """"""
    graph_json_dict = node_link_data(graph)

    # Convert annotation list definitions (which are sets) to canonicalized/sorted lists
    graph_json_dict['graph'][GRAPH_ANNOTATION_LIST] = {
        keyword: list(sorted(values))
        for keyword, values in graph_json_dict['graph'].get(GRAPH_ANNOTATION_LIST, {}).items()
    }

    # Convert set to list
    graph_json_dict['graph'][GRAPH_UNCACHED_NAMESPACES] = list(
        graph_json_dict['graph'].get(GRAPH_UNCACHED_NAMESPACES, [])
    )

    return graph_json_dict
310007
public ObjectNode toJson() {
		ObjectMapper mapper = new ObjectMapper();
		ObjectNode node = mapper.createObjectNode();
		ObjectNode unitIntervalNode = mapper.createObjectNode();

		node.put(intervalUnit.getUnitNodeName(), unitIntervalNode);
		unitIntervalNode.put("interval", buildIntervalNode());
		unitIntervalNode.put("aggregationType", intervalUnit.name());

		return node;
	}
893303
@Override
	public GraphRequest<JsonNode> graph(String object, Param... params) {
		return this.graph(object, JsonNode.class, params);
	}
795622
private Array _deserializeArray(Element el) throws ConverterException {
	Array array = new ArrayImpl();

	NodeList list = el.getChildNodes();
	int len = list.getLength();
	for (int i = 0; i < len; i++) {
	    Node node = list.item(i);
	    if (node instanceof Element) try {
		array.append(_deserialize((Element) node));
	    }
	    catch (PageException e) {
		throw toConverterException(e);
	    }

	}
	return array;
    }
406350
def deserialize(self, serialized):
        '''
        '''
        deserialized = json.loads(serialized)
        if deserialized.get('identifier') is None:
            return self._deserialize_v2(deserialized)
        else:
            return self._deserialize_v1(deserialized)
311336
def serialize(self):
        '''
        
        '''
        return json.dumps(json_graph.node_link_data(self.__nxgraph), cls=Encoder)
1060128
def _deserialize(cls, json_body, get_value_and_type):
        

        instance = cls()
        is_set = False
        properties = cls._get_property_names(instance)

        def get_property_detail(name):
            p = [p for p in instance._property_details if p.name == name or p.field_name == name]
            return None if len(p) == 0 else p[0]

        for k in json_body:
            field = json_body[k]
            pd = get_property_detail(k)
            pn = k if not pd else pd.to_property_name(k)
            if pn in properties:
                v, t = get_value_and_type(field)
                initial_value = getattr(instance, pn)
                value = instance._field_to_property(v, t, pd, initial_value)
                setattr(instance, pn, value)
                is_set = True

        return instance if is_set else None
210369
function() {
    if (this._isSerializing){ return this.id || this.cid; }
    this._isSerializing = true;
    var json = _.clone(this.attributes);
    _.each(json, function(value, name) {
        if( _.isNull(value) || _.isUndefined(value) ){ return void 0; }
        _.isFunction(value.toJSON) && (json[name] = value.toJSON());
    });
    this._isSerializing = false;
    return json;
  }
237922
def deserialize(self, obj):
        """"""
        if obj['immutable']:
            return obj['value']
        else:
            guid = obj['value']
            if not guid in object_registry:
                instance = JSObject(self, guid)
                object_registry[guid] = instance
            return object_registry[guid]