Given a blob of JSON representing a Zenpy object, recursively deserialize it and
         any nested objects it contains. This method also adds the deserialized object
         to the relevant cache if applicable.
432296
def object_from_json(self, object_type, object_json, parent=None):
        
        if not isinstance(object_json, dict):
            return object_json
        obj = self.instantiate_object(object_type, parent)
        for key, value in object_json.items():
            if key not in self.skip_attrs:
                key, value = self._deserialize(key, obj, value)
            if isinstance(value, dict):
                value = ProxyDict(value, dirty_callback=getattr(
                    obj, '_dirty_callback', None))
            elif isinstance(value, list):
                value = ProxyList(value, dirty_callback=getattr(
                    obj, '_dirty_callback', None))
            setattr(obj, key, value)
        if hasattr(obj, '_clean_dirty'):
            obj._clean_dirty()
        self.api.cache.add(obj)
        return obj
440541
private byte[] json(Object object) {
        try {
            return mapper.writeValueAsBytes(object);
        } catch (JsonProcessingException e) {
            throw new ZendeskException(e.getMessage(), e);
        }
    }
49614
def load_json(json_list, into=None):
    
    def l2t(obj):
      if isinstance(obj, list):
        return tuple(l2t(L) for L in obj)
      elif isinstance(obj, dict):
        return frozendict(obj)
      else:
        return obj
    return TypeFactory.load(l2t(json_list), into=into)
303680
def deserialize(raw)
      begin
        case @serializer
        when :marshal
          Marshal.load(raw)
        when :json
          JSON.parse(raw, :create_additions => true)
        when :yaml
          YAML.load(raw)
        end
      rescue => e
        PEROBS.log.fatal "Cannot de-serialize object with #{@serializer} " +
          "parser: " + e.message
      end
    end
692258
def _deserialize(data)
      @data = {}
      data.each { |k, v| @data[k] = v.is_a?(POReference) ?
                                    POXReference.new(@store, v.id) : v }
      @data
    end
1116748
def from_json(self, json, models=None):
        ''' 
        '''
        if json is None:
            return None
        elif not isinstance(json, dict):
            raise DeserializationError("%s expected a dict or None, got %s" % (self, json))
        new_data = {}
        for key, value in json.items():
            key = self.keys_type.from_json(key, models)
            if isinstance(value, dict) and '__ndarray__' in value:
                new_data[key] = decode_base64_dict(value)
            elif isinstance(value, list) and any(isinstance(el, dict) and '__ndarray__' in el for el in value):
                new_list = []
                for el in value:
                    if isinstance(el, dict) and '__ndarray__' in el:
                        el = decode_base64_dict(el)
                    elif isinstance(el, list):
                        el = self.values_type.from_json(el)
                    new_list.append(el)
                new_data[key] = new_list
            else:
                new_data[key] = self.values_type.from_json(value, models)
        return new_data
50270
def deserialize_dict(self, attr, dict_type):
        
        if isinstance(attr, list):
            return {x['key']: self.deserialize_data(x['value'], dict_type) for x in attr}

        if isinstance(attr, ET.Element):
            # Transform <Key>value</Key> into {"Key": "value"}
            attr = {el.tag: el.text for el in attr}
        return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()}
1361362
def deserialize(cls, v, bind_client=None):
        
        if v is None:
            return None
        o = cls(bind_client=bind_client)
        o.from_dict(v)
        return o
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))
1084022
def _deserialize(cls, key, value, fields):
        
        converter = cls._get_converter_for_field(key, None, fields)
        return converter.deserialize(value)
224273
function(key) {

          // First check to see if it's the object cache
          var cached = objectCache[key];
          if (cached) {
            return cached;
          }

          // Deserialize the object from JSON
          var json = persistenceStrategy.get(key);

          // null or undefined --> return null.
          if (json == null) {
            return null;
          }

          try {
            return JSON.parse(json);
          } catch (err) {
            return null;
          }
        }
1333684
def deserialize_object(definition, hash)
      return nil if hash.nil?
      result = definition.new
      result.__fields.each do |field|
        name = field.key_json || name_to_json(field.sym)

        if field.options[:as] == :list
          value = deserialize_list(hash[name], field)
        elsif field.options[:as] == :dto
          value = deserialize_object(field.options[:of], hash[name])
        else
          value = hash[name]
        end

        next if value.nil?

        result.send("#{field.key_ruby}=", value)
      end
      result
    end
30198
private Object deserialize() {
    SerializingTranscoder tc = new SerializingTranscoder();
    CachedData d = new CachedData(this.getItemFlags(), this.getValue(),
      CachedData.MAX_SIZE);
    Object rv = null;
    rv = tc.decode(d);
    return rv;
  }
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
1022587
def loads(s, encoding=None, cls=JSONTreeDecoder, object_hook=None,
         parse_float=None, parse_int=None, parse_constant=None,
         object_pairs_hook=None, **kargs):
    
    return json.loads(s, encoding, cls, object_hook,
         parse_float, parse_int, parse_constant,
         object_pairs_hook, **kargs)
593448
def deserialize(self, d):
        
        children = []
        for child in d.pop('children'):
            if isinstance(child, dict):
                children.append(self.deserialize(child))
            else:
                children.append(self.prepare_value(child))
        query = Q()
        query.children = children
        query.connector = d['connector']
        query.negated = d['negated']
        if 'subtree_parents' in d:
            query.subtree_parents = d['subtree_parents']
        return query
730037
def deserialize(self, response_json):
        
        response_objects = dict()
        if all((t in response_json for t in ('ticket', 'audit'))):
            response_objects["ticket_audit"] = self.object_mapping.object_from_json(
                "ticket_audit",
                response_json
            )

        # Locate and store the single objects.
        for zenpy_object_name in self.object_mapping.class_mapping:
            if zenpy_object_name in response_json:
                zenpy_object = self.object_mapping.object_from_json(
                    zenpy_object_name,
                    response_json[zenpy_object_name]
                )
                response_objects[zenpy_object_name] = zenpy_object

        # Locate and store the collections of objects.
        for key, value in response_json.items():
            if isinstance(value, list):
                zenpy_object_name = as_singular(key)
                if zenpy_object_name in self.object_mapping.class_mapping:
                    response_objects[key] = []
                    for object_json in response_json[key]:
                        zenpy_object = self.object_mapping.object_from_json(
                            zenpy_object_name,
                            object_json
                        )
                        response_objects[key].append(zenpy_object)
        return response_objects