nti.externalization.representation
: Reading and writing objects to strings¶
External representation support.
The provided implementations of
IExternalObjectIO
live here. We
provide and register two, one for JSON
and one for
YAML
.
-
to_external_representation
(obj, ext_format='json', name=NotGiven) → str[source]¶ Transforms (and returns) the obj into its external (string) representation.
Uses
nti.externalization.to_external_object()
, passing in the name.Parameters: ext_format (str) – One of EXT_REPR_JSON
orEXT_REPR_YAML
, or the name of some other utility that implementsIExternalObjectRepresenter
-
to_json_representation
(obj)[source]¶ A convenience function that calls
to_external_representation()
withEXT_REPR_JSON
.