diff --git a/platypush/plugins/utils/__init__.py b/platypush/plugins/utils/__init__.py index 989f3e2b72..d969904b68 100644 --- a/platypush/plugins/utils/__init__.py +++ b/platypush/plugins/utils/__init__.py @@ -3,6 +3,8 @@ import threading import time from typing import Dict, Union +import yaml + from platypush.backend.http.utils import HttpUtils from platypush.config import Config from platypush.plugins import Plugin, action @@ -363,5 +365,12 @@ class UtilsPlugin(Plugin): return docutils.core.publish_parts(text, writer_name='html')['html_body'] + @action + def to_yaml(self, obj: Union[dict, list, tuple, str, int, float, bool]): + """ + Convert an object to YAML + """ + return yaml.dump(obj, indent=2) + # vim:sw=4:ts=4:et: