Get the serialized data from the :class:`Serializer`.

        The data will be cached for future accesses.
181266
def data(self):
        
        # Cache the data for next time .data is called.
        if self._data is None:
            self._data = self.to_value(self.instance)
        return self._data
1100242
def get_data(self, collection):
        """"""
        data = self._filter_queryset('view_data', collection.data.all())

        return self._serialize_data(data)
1300734
def _deserialize(self, data: dict, silent=True) -> dict:
        '''  '''
        deserialized_data = {}
        for name, field in self._fields.items():
            if field._readonly is False and name in data:
                deserialized_data[name] = data.get(name)
        return deserialized_data
136768
def get_serializer_info(self, serializer):
        
        if hasattr(serializer, 'child'):
            # If this is a `ListSerializer` then we want to examine the
            # underlying child serializer instance instead.
            serializer = serializer.child

        # Remove the URL field if present
        serializer.fields.pop(api_settings.URL_FIELD_NAME, None)

        return OrderedDict([
            (field_name, self.get_field_info(field))
            for field_name, field in serializer.fields.items()
        ])
94056
def get_serializer(self, *args, **kwargs):
        
        serializer_class = self.get_serializer_class()
        kwargs['context'] = self.get_serializer_context()
        return serializer_class(*args, **kwargs)
624332
def loads(self, value):
    ''''''
    for serializer in reversed(self):
      value = serializer.loads(value)
    return value
1212451
def serialize(self):
        """"""
        # Serialize fields to a dict
        data = {}
        for field_name in self:
            value = self._values.get(field_name)
            field = self.fields.get(field_name)
            if value is not None:
                if field.all:
                    value = [field.serialize(v) for v in value]
                else:
                    value = field.serialize(value)
            # Skip empty fields unless field.null
            if not field.null and ((field.all and value == []) or (not field.all and value in {None, ''})):
                continue
            data[field.name] = value
        return data
145561
def _dumps(self, obj):
        
        if not self.serialized:
            return obj
        return self.serializer.dumps(obj)
783395
def get_content(self, obj):
        
        serializer = ContentSerializer(
            instance=obj.contentitem_set.all(),
            many=True,
            context=self.context,
        )
        return serializer.data
1354518
def get_fields(self):
        """"""
        fields = super(CollectionSerializer, self).get_fields()

        if self.request.method == "GET":
            fields['data'] = serializers.SerializerMethodField()
        else:
            fields['data'] = serializers.PrimaryKeyRelatedField(many=True, read_only=True)

        return fields
990347
def bench_serpy():
    

    class FooSerializer(serpy.DictSerializer):
        """The serializer schema definition."""
        # Use a Field subclass like IntField if you need more validation.
        attr_2 = serpy.IntField()
        attr_1 = serpy.StrField()

    return [FooSerializer(obj).data for obj in object_loader()]
1003085
def serialize(self) -> dict:
        
        data = {**self}
        if "attachments" in self:
            data["attachments"] = json.dumps(self["attachments"])
        return data
257866
def serialized(self):
        
        serialized = {}
        for k, v in six.iteritems(self):
            serialized[k] = self._serialize(k, v, self._fields)
        return serialized
233082
def get_serializer_in(self, *args, **kwargs):
        
        serializer_class = self.get_serializer_class_in()
        kwargs['context'] = self.get_serializer_context()
        return serializer_class(*args, **kwargs)
1283832
def get_data(self):
        
        try:
            return DocumentDataDict(self.__dict__['data'])
        except KeyError:
            self._lazy_load()
            return DocumentDataDict(self.__dict__['data'])
628306
def get_serializer(
            self,
            action_kwargs: Dict=None,
            *args, **kwargs) -> Serializer:
        
        serializer_class = self.get_serializer_class(
            **action_kwargs
        )

        kwargs['context'] = self.get_serializer_context(
            **action_kwargs
        )

        return serializer_class(*args, **kwargs)
1293446
def serialize_detail(self, data):
        
        if data is None:
            return ''

        # Check for a ``Data``-like object. We should assume ``True`` (all
        # data gets prepared) unless it's explicitly marked as not.
        if not getattr(data, 'should_prepare', True):
            prepped_data = data.value
        else:
            prepped_data = self.prepare(data)

        return self.serializer.serialize(prepped_data)