(
        value: Any, default: Any = None, sort_keys: bool = False
    )
The `tojson` context method can be used to serialize a Python
        object primitive, eg. a `dict` or `list` to a json string.

        :param value: The value serialize to json
        :param default: A default value to return if the `value` argument
            cannot be serialized
        :param sort_keys: If True, sort the keys.


        Usage:

            {% set my_dict = {"abc": 123} %}
            {% set my_json_string = tojson(my_dict) %}
            {% do log(my_json_string) %}
The `tojson` context method can be used to serialize a Python
        object primitive, eg. a `dict` or `list` to a json string.
The tojson context method can be used to serialize a Python object primitive eg . a dict or list to a json string .
def tojson(
        value: Any, default: Any = None, sort_keys: bool = False
    ) -> Any:
        """The `tojson` context method can be used to serialize a Python
        object primitive, eg. a `dict` or `list` to a json string.

        :param value: The value serialize to json
        :param default: A default value to return if the `value` argument
            cannot be serialized
        :param sort_keys: If True, sort the keys.


        Usage:

            {% set my_dict = {"abc": 123} %}
            {% set my_json_string = tojson(my_dict) %}
            {% do log(my_json_string) %}
        """
        try:
            return json.dumps(value, sort_keys=sort_keys)
        except ValueError:
            return default
def tojson ( value : Any , default : Any = None , sort_keys : bool = False ) -> Any : try : return json . dumps ( value , sort_keys = sort_keys ) except ValueError : return default