{%- macro debug_print(name, value) -%} {% if value is object -%} {%- for key, inner_value in value -%} {{ self::debug_print(name=name ~ "." ~ key, value=inner_value) }} {%- endfor -%} {% elif value is iterable -%} {%- for inner_value in value -%} {{ self::debug_print(name=name ~ "[" ~ loop.index0 ~ "]", value=inner_value) }} {%- endfor -%} {% else -%} {{ name }} = "{{ value }}" {% endif -%} {%- endmacro debug_print -%} {%- macro json_print(name, value, identation) -%} {% if value is object -%} {{identation}}{ {% for key, inner_value in value -%} {{identation ~ " "}}"{{key}}": {{ self::json_print(name=key, value=inner_value, identation=identation ~ " ") }}{% if not loop.last %},{% endif %} {% endfor -%} {{identation}}} {%- elif value is iterable -%} {{identation}}[ {% for inner_value in value -%} {{identation}}{{ self::json_print(name=name, value=inner_value, identation=identation ~ " ") }}{% if not loop.last %},{% endif %} {% endfor -%} {{identation}}] {%- else -%} {% if value is string %}"{{ value | escape }}"{% else %}"{{value}}"{% endif %} {%- endif -%} {%- endmacro json_print %}