MCPcopy
hub / github.com/marshmallow-code/marshmallow / dumps

Method dumps

src/marshmallow/schema.py:581–595  ·  view source on GitHub ↗

Same as :meth:`dump`, except return a JSON-encoded string. :param obj: The object to serialize. :param many: Whether to serialize `obj` as a collection. If `None`, the value for `self.many` is used. :return: A ``json`` string .. versionchanged:: 3.0.0b7

(self, obj: typing.Any, *args, many: bool | None = None, **kwargs)

Source from the content-addressed store, hash-verified

579 return result
580
581 def dumps(self, obj: typing.Any, *args, many: bool | None = None, **kwargs):
582 """Same as :meth:`dump`, except return a JSON-encoded string.
583
584 :param obj: The object to serialize.
585 :param many: Whether to serialize `obj` as a collection. If `None`, the value
586 for `self.many` is used.
587 :return: A ``json`` string
588
589 .. versionchanged:: 3.0.0b7
590 This method returns the serialized data rather than a ``(data, errors)`` tuple.
591 A :exc:`ValidationError <marshmallow.exceptions.ValidationError>` is raised
592 if ``obj`` is invalid.
593 """
594 serialized = self.dump(obj, many=many)
595 return self.opts.render_module.dumps(serialized, *args, **kwargs)
596
597 def _deserialize(
598 self,

Callers

nothing calls this directly

Calls 1

dumpMethod · 0.95

Tested by

no test coverage detected